Open GoogleCodeExporter opened 9 years ago
I'd like to build this as part of "assistedinject++". Here's a sketch of the
API in case you're curious:
The user specifies any factory interface:
interface ViewSource {
UserSpecificView create(User user);
}
In their Injector, they bind User.class to a special target. Not sure the
correct words, but the idea is generally
something like this:
bind(User.class).asCreateTimeParameter();
and they bind the factory, just like in AssistedInject:
bind(ViewSource.class).toProvider(FactoryProvider.factoryFor(RealUserSpecificView.class));
But unlike assistedinject, the User parameter can be injected anywhere: In the
returned RealUserSpecificView
class, in its dependencies, or even as a Provider within its dependencies.
Behind-the-scenes this will create a
child injector that has a proper binding for User.class. It will fulfill the
ViewSource injection using that
injector.
Original comment by limpbizkit
on 19 Jun 2008 at 9:05
Original comment by cgruber@google.com
on 16 Jul 2012 at 6:15
Original comment by cgruber@google.com
on 18 Nov 2013 at 8:05
Original issue reported on code.google.com by
bslesinsky
on 18 Jun 2008 at 11:56