java - Injecting factory class to other beans -


i have factory class , wonder if possible inject animalmapper factory class other beans needs it?

animalmapper factory class

public static mapper create(final string type) {     if (type.equalsignorecase("dog")) {         return new dogmapper();     } else if (type.equalsignorecase("cat")) {         return new catmapper();     } ... } 

currently using animalmapper.create(...)

here sample code

public class testclass{    //member variable defination.      @inject    animalmapper animalmapper; //defining mapper instance } 

i not sure if looking if can clarify question more can add more details.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -