public interface Animal {
public static void makeNoise() {
}
}
public class Sheep implements Animal {
public static void makeNoise() {
}
}
Clients should be able to just do the following and they should not know what object is getting injected from behind the scenes?
Animal.makeNoise();
Factory pattern still needs to know the key that maps to a concrete class so I am looking for other options. is there a way I can overwrite the ClassLoader for Animal and somehow inject the sheep object without using any frameworks like spring or whatever? any code sample for this kind of small example would be great!