Comment #1 on issue 530 by sberlin: Add FactoryModuleBuilder.getProvider to
support Command Pattern use case
http://code.google.com/p/google-guice/issues/detail?id=530
A related thing came up today, so I feel compelled to note that my
suggested workaround in the thread linked above can be slightly shortened
to:
for ( Fruit fruit : Fruit.values() ) {
Key key = Key.get(FactoryModuleBuilder.class,
UniqueAnnotation.create());
install(new FactoryModuleBuilder().build(key));
mapBinder.addBinding(fruit).to(key);
}
again, where you'd have to recreate something like
UniqueAnnotation.create(). the toProvider(getProvider(..)) is unnecessary
in the above because the mapbinder will do the correct thing given the
object key. toProvider(aProvider) would only be necessary if all you had
access to was a provider object (which, as this issue notes, could be added
with something like FactoryModuleBuilder.getProvider).
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" 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-dev?hl=en.