On 02/07/10 10:31, [email protected] wrote:
On Jul 1, 3:30 pm, Jeremy  Chone<[email protected]>  wrote:
Is this a wanted feature or a bug? Is there any way to avoid to have
one setter per property while keeping any of them optional?
It's a feature. Although they're frequently confused, 'optional=true'
and @Nullable mean quite different things.

'@Inject(optional=true)' means that the injector should suppress any
error from not being able to fulfill the dependencies of an injection.
The injector will try its best to find bindings, even if that involves
creating just-in-time bindings. But if any of the parameters to a
method cannot be satisfied, the entire call is skipped.

'@Nullable' means that the injector will not report an error if a null
value is returned by the binding for an injection. The binding must
still exist. The only time @Nullable is useful is when you implement a
provider method (@Provides) or a provider class that may return null.
Or if null represents a valid value for your particular use case.

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