You might consider using a MapBinder instead of annotations. Take a look at this thread and see if it looks like it might be what you want. http://groups.google.com/group/google-guice/browse_thread/thread/3c86c7712deae803
Leigh. On Nov 8, 3:27 am, leszek <[email protected]> wrote: > I'm using "multi binding" - look at the code snippet below: > > public interface ICommand { > void doSomething(); > > } > > (module) > > bind(ICommand.class).annotatedWith(Names.named("UserCommand")).to > (UserCommandConcrete.class); bind(IICommand.class).annotatedWith > (Names.named("AdminCommand")).toAdminCommandConcrete.class); > > then can get instance via: > > ICommand iRun = injector.getInstance( > Key.get(ICommand.class, > Names.named("UserCommand))); > > ------------------- > > But I need some extra parameters to UserCommandConcrete constructor > e.g. > > class UserCommandConcrete implements ICommand { > > private final String userInfo; > > �...@inject > public UsetCommandConcrete(String userInfo) { > this.userInfo = userInfo; > } > > ........ > > } > > In "single binding" I can accomplish that with factory and @Assisted > annotation. > > But what about "multi binding" ? Is there any way ? -- 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=.
