Hi Guice users.

I'm rather new to Guice, but I'm really enjoying it.
I have a fairly simple problem, but I can't figure out how to solve
this.

In my application I have some variables, which I want to use to decide
which instance to create.

e.g.
my modules
        bind(GlobalSearchController.class)
            .annotatedWith(Names.named("SOME_CONSTANT"))
                .to(GlobalSearchControllerImpl.class);


        bind(GlobalSearchController.class)
            .annotatedWith(Names.named("SOME_OTHER_CONSTANT"))
                .to(GlobalSearchControllerOtherImpl.class);

...
so then later in my code has
String = "SOME_CONSTANT";

now how do I get Guice to give me an instance which matches to my
constant?

write now I have written a provider, which does IF/ELSE before
creating an instance with new.
Its not really now I envisaged solving this problem.

Thanks in advance

Martin

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