hk2 4.0.1
org.glassfish.hk2.api
org.jvnet.hk2.annotations
Optional
Top
Description
Methods
org.jvnet.hk2.annotations
public
@Interface Optional
extends
Annotation
Annotations
@Documented
@Retention
:
RUNTIME
@Target
:
METHOD
,
FIELD
,
PARAMETER
Static Imports
java.
lang.
annotation.
ElementType.
FIELD
,
.ElementType.
METHOD
,
.ElementType.
PARAMETER
,
.RetentionPolicy.
RUNTIME
Marker annotation indicating that an instance variable or method marked with
jakarta.
inject.
Inject
is not required to be present at run-time. If the service is not present, there will be no error and injection will not be performed.
Example:
@Inject @Optional MyContract myOptionalService;
Author
Mason Taube
Method Summary
Inherited from
java.lang.annotation.Annotation
:
annotationType
equals
hashCode
toString