Provides access to metadata about an injection point. May represent an {@linkplain javax.inject.Inject injected field} or aparameter of a {@linkplain javax.inject.Inject bean constructor}, {@linkplain javax.inject.Inject initializer method}, {@linkplain javax.enterprise.inject.Produces producer method}, {@linkplain javax.enterprise.inject.Disposes disposer method}or {@linkplain javax.enterprise.event.Observes observer method}.
If the injection point is a dynamically selected reference obtained then the metadata obtain reflects the injection point of the {@link Instance}, with the required type and any additional required qualifers defined by {@linkplain Instance Instance.select()}.
Occasionally, a bean with scope {@link javax.enterprise.context.Dependent @Dependent} needs to access metadata relatingto the object to which it belongs. The bean may inject an {@code InjectionPoint} representing the injection point into whichthe bean was injected.
For example, the following producer method creates injectable Logger s. The log category of a Logger depends upon the class of the object into which it is injected.
@Produces Logger createLogger(InjectionPoint injectionPoint) { return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName()); }
Only {@linkplain javax.enterprise.context.Dependent dependent} objects, may obtain information about the injection point towhich they belong.
@author Gavin King @author Pete Muir
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|