My biggest problem with the @expose annotation is that you have to put
a constant string (or constant annotation) inside. You can't do
something like @Expose(some_dynamic_value).
To me it seems that this doesnt solve the problem with the "robot"
example  where you have to configure a left leg and a right leg in
almost identical manner. You would have to write two modules (or one
base module, two that inherits from it)
one with an @Expose("l_leg") and one with an @Expose("r_leg").
Maybe I'm wrong about this but the perfect solution seems to me to
be:  expose(Leg.class).annotatedWith(legName).toInstance(new LegImpl
()).

On 1 Dec., 10:23, "Robbie Vanbrabant" <[EMAIL PROTECTED]>
wrote:
> I also suggested to use @Provides(exposed=true) or @ProvidesExposed.
> @Exposed feels like a binding annotation.
> Robbie
>
> On Mon, Dec 1, 2008 at 1:39 AM, Dhanji R. Prasanna <[EMAIL PROTECTED]> wrote:
>
>
>
> > If we can avoid a new annotation I would be for it =)
>
> > Dhanji.
>
> > On Mon, Dec 1, 2008 at 11:11 AM, Mikkel Petersen <[EMAIL PROTECTED]>
> > wrote:
>
> > > IT seems like the new updates behave differently. It's enough to just
> > > declare a function @Provides @Exposed @Named and skip the
> > > expose() method entirely ?
>
> > > On Nov 30, 11:53 pm, Mikkel Petersen <[EMAIL PROTECTED]> wrote:
> > >> Sorry im using chrome and it suddenly posted  :)
>
> > >> OK anyway, what i was saying
>
> > >> @Provides
> > >>         @Exposed
> > >>         @Named("boxer1")
> > >>         public MovingRagdoll exposeRagdoll() {
> > >>                 return boxer;
> > >>         }
> > >> public void configurePrivateBindings() {
> > >>                 super.configurePrivateBindings();
>
> > expose(MovingRagdoll.class).annotatedWith(Names.named("boxer1"));
> > >>     }
>
> > >> Looks very clumsy to me and its not obvious to anyone why it's
> > >> necessary.  (with the extra @exposed @Named function
>
> > >> Why not ?
>
> > >> public void configurePrivateBindings() {
> > >>                 expose(MovingRagdoll.class).annotatedWith(Names.named
> > >> ("boxer1")).toInstance(boxer);
> > >>  }
>
> > >> Problem with the @Exposed @Named notation is that you cant reuse your
> > >> module, you have to write another module that injects (exposes) to
> > >> another name.
>
> > >> expose(MovingRagdoll.class).annotatedWith(Names.named(nameOfBoxer); is
> > >> reusing..
>
> > >> Hope this is clear.
>
> > --
> >http://twitter.com/dhanji
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to