How can i bind the different subtype of same type at runtime using google GUICE

2013-12-28 Thread vinay krishna
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

Re: How can i bind the different subtype of same type at runtime using google GUICE

2013-12-28 Thread Nate Bauernfeind
I don't really understand what you're asking. Perhaps, you don't realize that Guice does not require you to bind to an interface. For example, why can't you bind each class? bind(TestInstanceHelper.class).asEagerSingleton(); ... Then inject each instance into your DeliverableHelper? Or if you

Re: How can i bind the different subtype of same type at runtime using google GUICE

2013-12-28 Thread Cédric Beust ♔
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