I am in exact similar situation as the OP which posted this few years back !
similar to the HandlerFactory above,
when we need simple factory technique in which
based on the argument, we need to create corresponding object.
how can we do this with Guice ?
I am familiar with Binding Annotations, but I don't think they can replace
simple factory technique.
because annotations must be created in advance.
what I am looking for, is some kind of a Provider, a Parametrized provider,
that takes a String as input.
lets say:
FooA extends Foo
FooB extends Foo
FooC extends Foo
//Typical Provider
Provider<Foo> fooProvider;
Foo foo = fooProvider.get();
with a parametrized version
based on user input, some event, some data,
we get hold of *STRING X*
if(X==A) create FooA
if(X==B) create FooB
if(X==C) create FooC
....
I am wondering if this kind of Provider is available or can be of any value
?
FooA fooA = fooProvider.get("A")
FooB fooB = fooProvider.get("B")
or in general, do you have any advice on how to implement simple factory
technique with Guice ?
Thank You
--
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.