2010/1/5 JN <[email protected]>:
> On Jan 4, 12:58 pm, "Dhanji R. Prasanna" <[email protected]> wrote:
>> You're going to want to build from trunk for toConstructor() and any other
>> 2.1 features.
>>
>> I'll update the javadoc.
>
> Thanks. Any indication when 2.1 might be released? How stable is
> trunk?
You can always create objects manually using providers or "@Provides"
methods of the module. Say you have a class SecretService with
constructor:
public SecretService(ServiceA sa, ServiceB sb) {
..
}
And you do not want or you cannot annotate this class. Simply write
this is a method in a module:
@Provides
public SecretService secretService(ServiceA sa, ServiceB sb) {
return new SecretService(sa, sb);
}
Isn't it nice and clean solution if you cannot (or if you do not want)
to annotate SecretService?
If you want SecretService to be a singleton, just add @Singleton to
the method signature... or any other scope you might have.
--
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.