Yeah, that works:

bind(FooComponentImpl.class)
    .annotatedWith(Names.named(ONE))
    .to(FooComponentImpl.class)
    .in(Scopes.SINGLETON);
bind(FooComponentImpl.class)
    .annotatedWith(Names.named(TWO))
    .to(FooComponentImpl.class)
    .in(Scopes.SINGLETON);

bind(FooComponent.class)
    .annotatedWith(Names.named(ONE))
    .to(Key.get(FooComponentImpl.class,
                Names.named(ONE)));
bind(FooComponent.class)
    .annotatedWith(Names.named(TWO))
    .to(Key.get(FooComponentImpl.class,
                Names.named(TWO)));

Of course you can clean this up by creating constants for the
annotations, etc.  I'm going to go one further and write up a generic
annotation generator based on enums so I can get rid of all those
silly Strings.

Thanks all!

-Russ

-- 
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