If you’re using new for these, no point in using Guice. If not, something like that
@Injectprivate TestInstanceHelper tih; @Injectprivate TestElementHelper teh; // switch and assign The fact they are subtypes of a common class is irrelevant. Also, multibinders might help you do something more elegant than with switch/case. -- Cédric On Fri, Dec 27, 2013 at 5:57 AM, vinay krishna <[email protected]>wrote: > I have defined a superclass : > > public abstract class DeliverableHelper > > There are three classes which is extending DeliverableHelper :- > > TestInstanceHelper,AssetHelper and TestElementHelper > > I am using a factory class to resolve which class will be called at > runtime :- > > below is the code of the factory class :- > > public DeliverableHelper getWorkflowHelper(DeliverableType > deliverableType) throws DfException { > DeliverableHelper workflowClass = null; > switch (deliverableType) { > > case TCP: > workflowClass = new TestInstanceHelper(); > > break; > case TET: > workflowClass = new TestElementHelper(); > break; > case ASSET: > workflowClass = new AssetHelper(); > break; > default: > throw new DfException("Deliverable type is not valid"); > > } > return workflowClass; > } > > How can i fit all these using google guice binding. > > -- > You received this message because you are subscribed to the Google Groups > "google-guice" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/google-guice. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-guice. For more options, visit https://groups.google.com/groups/opt_out.
