Interface InjectionResolver<T extends java.lang.annotation.Annotation>
-
- Type Parameters:
T
- This must be the annotation class of the injection annotation that this resolver will handle.
- All Known Subinterfaces:
ContextInjectionResolver
- All Known Implementing Classes:
ContextInjectionResolverImpl
,ParamInjectionResolver
,PersistenceUnitBinder.PersistenceUnitInjectionResolver
public interface InjectionResolver<T extends java.lang.annotation.Annotation>
This class allows users to provide a custom injection target for any annotation (including@Inject
). The user would usually only provide a resolver for@Inject
if it were specializing the system provided resolver for@Inject
. Otherwise, this resolver can be used to provide injection points for any annotation.Jersey provides all
InjectionResolvers
for JAX-RS annotation andorg.glassfish.jersey.server.Uri
apart fromContext
which must be implemented and registered directly as a part of DI integration because of many optimization which cannot be implemented on Jersey side.The
InjectionResolvers
are delivered to DI integration usingInjectionManager.register(Binder)
and DI provider just filterInjectionResolverBinding
and internally register the annotation handling using its own mechanism.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Class<T>
getAnnotation()
This method returns the annotation for what the injection resolver is implemented.boolean
isConstructorParameterIndicator()
This method should return true if the annotation that indicates that this is an injection point can appear in the parameter list of a constructor.boolean
isMethodParameterIndicator()
This method should return true if the annotation that indicates that this is an injection point can appear in the parameter list of a method.java.lang.Object
resolve(Injectee injectee)
This method will return the object that should be injected into the given injection point.
-
-
-
Method Detail
-
resolve
java.lang.Object resolve(Injectee injectee)
This method will return the object that should be injected into the given injection point. It is the responsibility of the implementation to ensure that the object returned can be safely injected into the injection point.This method should not do the injection themselves.
- Parameters:
injectee
- The injection point this value is being injected into- Returns:
- A possibly null value to be injected into the given injection point
-
isConstructorParameterIndicator
boolean isConstructorParameterIndicator()
This method should return true if the annotation that indicates that this is an injection point can appear in the parameter list of a constructor.- Returns:
- true if the injection annotation can appear in the parameter list of a constructor.
-
isMethodParameterIndicator
boolean isMethodParameterIndicator()
This method should return true if the annotation that indicates that this is an injection point can appear in the parameter list of a method.- Returns:
- true if the injection annotation can appear in the parameter list of a method.
-
getAnnotation
java.lang.Class<T> getAnnotation()
This method returns the annotation for what the injection resolver is implemented.- Returns:
- handled annotation by injection resolver.
-
-