It's there...look at the javadoc (it's not obvious).
I would like to use a binding annotation on the binding generated in a FactoryModuleBuilder. FactoryModuleBuilder does not have an obvious way to add this, so I plan to use the Module generated by the FactoryModuleBuilder to create a FactoryProvider via an Injector created from that Module which I can then bind via annotation. Is there a better way to do this and are annotated bindings for assisted injection a planned feature?Cheers,Mike--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-guice/-/eKe2L9h0dvEJ.
To post to this group, send email to google...@googlegroups.com.
To unsubscribe from this group, send email to google-guice...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.
On Saturday, July 14, 2012 8:24:44 AM UTC-4, Fred wrote:It's there...look at the javadoc (it's not obvious).
There is javadoc about creating annotations for the return types of the factory which the FactoryModuleBuilder creates; however, I do not see any for annotating the binding to the factory created by the FactoryModuleBuilder.To be clear, I do not want to dointerface CarFactory {@Named("fast") Car getFastCar(Color color);@Named("clean") Car getCleanCar(Color color);}...protected void configure() {install(new FactoryModuleBuilder().implement(Car.class, Names.named("fast"), Porsche.class).implement(Car.class, Names.named("clean"), Prius.class).build(CarFactory.class));}but ratherprotected void configure() {install(new FactoryModuleBuilder().implement(Car.class, Names.named("fast"), BluePorsche.class).implement(Car.class, Names.named("clean"), BluePrius.class).build(CarFactory.class).annotatedWith(Blue.class));install(new FactoryModuleBuilder().implement(Car.class, Names.named("fast"), RedPorsche.class).implement(Car.class, Names.named("clean"), RedPrius.class).build(CarFactory.class).annotatedWith(Red.class));}However, that .annotatedWith does not exist for Module or in the FactoryModuleBuilder.Apologies my initial question was not clear.
--
On Jul 14, 2012 8:11 AM, "Mike Atkins" wrote:I would like to use a binding annotation on the binding generated in a FactoryModuleBuilder. FactoryModuleBuilder does not have an obvious way to add this, so I plan to use the Module generated by the FactoryModuleBuilder to create a FactoryProvider via an Injector created from that Module which I can then bind via annotation. Is there a better way to do this and are annotated bindings for assisted injection a planned feature?Cheers,Mike--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-guice/-/onZ2hX59qDwJ.