@Qualifier @Documented @Target(value={METHOD,FIELD,PARAMETER}) @Retention(value=RUNTIME) public @interface Optional
null
value will be injected;
Note that null
is as an acceptable value and is not the same as a
value not being found. For example, the IEclipseContext
-based supplier distinguishes
between a value being set to null (i.e., context.set(SOMEKEY, null)
)
and the value not found (i.e., context.remove(SOMEKEY)
).
Example usage:
public class Car { @Inject @Optional void setOverdrive(OverdriveMode mode); ... }
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.