Hi,
presently I have a class that has multiple constructors:
class SomeClass
{
@AssistedInject
public SomeClass(SomeService service, @Assisted Kicks kicks)
{
...
}
@AssistedInject
public SomeClass(SomeService service, @Assisted Laughs laughs)
{
...
}
}
Since I only want the SomeService parameter injected I've been using
the AssistedInject extension.
Using the Assisted extension I've created a interface that looks
something like:
interface SomeClassFactory
{
SomeClass forKicks(Kicks kicks);
SomeClass forLaughs(Laughs laughs);
}
And I bind it in the usual manner:
bind(SomeClassFactory.class).toProvider(FactoryProvider.newFactory
(SomeClassFactory.class, SomeClass.class));
Everything works fine _except_ @AssistedInject is now deprecated (I'm
currently using snapshot 20090205).
The problem is, if I replace @AssistedInject with @Inject (which was
my understanding of what the documentation said to do) I get
exceptions trying to build the Injector:
SomeClass has more than one constructor annotated with @Inject.
Classes must have either one (and only one) constructor annotated with
@Inject or a zero-argument constructor that is not private.
My question is, is there a way forward that will allow me to have
multiple DI constructors that doesn't rely on deprecated code?
Cheers,
Andy
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---