Is possible to combine MapBinder and Assisted Injection?

I have a MapBinder as below in my Module:

MapBinder<String, IFoo> mapBinder =
                MapBinder.newMapBinder(binder(), String.class,
IFoo.class);

mapBinder.addBinding(Bar.ONE).to(FooOne.class);
mapBinder.addBinding(Bar.TWO).to(FooTwo.class);

This works great and the IFoo implementations can be retrieved like
so:

private final Map<String, IFoo> foos;

@Inject
public FooMap(Map<String, ICommand> foos) {
    this.foos = foos;
}

public void doSomething(IBar b) {
    IFoo foo = foos.get(b.getType());
    foo.execute();
}

I'd like to have the parameter of the 'doSomething' method be
@Assisted into the Foo that comes out of the map. I think you can do
it with a FactoryProvider for each IFoo implementation. Is it possible
to have a single FactoryProvider handle the creation. Could I inject
the foos map in a Factory and have them come out with an @Assisted
IBar instance in them?

thanks!

-- 
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.

Reply via email to