My recommendation was "<T> T create(String);", but that's still a nonsolution with the same error you posted, so sorry for that.
Stepping back, it seems you have a string and want to create any number of classes depending on the argument you have at runtime. Effectively this amounts to having a map of factories. You could model this in guice by using a mapbinder to contribute individual factories, and build a method around that for ease of binding. You'd then author the factory and inject this map into it. On Fri, Aug 31, 2012 at 12:41 PM, Cédric Beust ♔ <[email protected]> wrote: > > On Fri, Aug 31, 2012 at 9:32 AM, Fred Faber <[email protected]> wrote: > >> However, could you drop the type token and use LHS inference alone? > > > Not without having to use different names for my create methods (Java > overloading rules). I'm trying to avoid having to add a new factory method > each time I add a new subclass... > > -- > Cédric > > -- > You received this message because you are subscribed to the Google Groups > "google-guice" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-guice?hl=en. > -- You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.
