On Nov 30, 2:53 pm, Mikkel Petersen <[EMAIL PROTECTED]> wrote:
> Why not ?
> expose(MovingRagdoll.class).annotatedWith(Names.named("boxer1")).toInstance(boxer);It's certainly more concise. Unfortunately, it might break on some corner cases... Guice allows untargetted bindings. For example, this tells Guice to create a binding for Concrete using @ProvidedBy, @ImplementedBy, or an @Inject constructor: bind(Concrete.class); With private modules, you're allowed to expose bindings that you didn't create yourself: install(new CementTruckModule()); expose(Concrete.class); So if expose acts as both expose and as bind, the following is ambiguous: expose(Concrete.class); That said, it might be handy to have a method bindAndExpose() when you want to do both. I've written a proof-of-concept: http://docs.google.com/Doc?id=dhfm3hw2_47dc4pb3d8 If there's overwhelming demand, we could alternately add a method to the binding DSL. I don't really think it'll happen though, because that will show up on all bindings, public and private. bind(Concrete.class) .to(RealConcrete.class) .in(Singleton.class) .andExposeItForAllToSee(); --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
