Hi Folks,
Currently, AssistedInject allows a factory interface to map to
multiple constructors of a single type. This works very well when
there's a variety of constructors for convenience. What do you think
about extending AssistedInject's utility so that it might be able to
assist in creating a variety of types. That is, something like:
interface FooFactory {
MetalFoo createMetalFoo(Metal type);
ShinyFoo createShinyFoo(Shine type);
DullFoo createDullFoo(Fade type);
}
with the bindings looking something like:
bind(FooFactory.class).
toProvider(FactoryProvider.newFactory(FooFactory.class).
with(FactoryProvider.map(MetalFoo).to(MetalFooImpl.class)).
with(FactoryProvider.map(ShinyFoo).to(ShinyFooImpl.class)).
with(FactoryProvider.map(DullFoo).to(DullFooImpl.class))
.provider());
That's just a syntax off the top of my head -- I'm sure it can be done cleaner.
This would greatly help in reducing the proliferation of factory
interfaces for related and/or simple things.
Sam
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---