Package org.jvnet.hk2.config
Class InjectionResolver<U extends Annotation>
- java.lang.Object
-
- org.jvnet.hk2.config.InjectionResolver<U>
-
- Type Parameters:
U
- U is the annotation used to identify the injection targets.
- All Implemented Interfaces:
InjectionResolverQuery
- Direct Known Subclasses:
MapInjectionResolver
public abstract class InjectionResolver<U extends Annotation> extends Object implements InjectionResolverQuery
Implementation of this abstract class are handling injection resolution for a particular injection annotation {@see Inject} Injection targets are identified by the generic parameter and the constructor of this class. Potential injection targets are fields and methods of the injected type.- Author:
- Jerome Dochez
-
-
Constructor Summary
Constructors Constructor Description InjectionResolver(Class<U> type)
Construct a resolver with a particular injection type
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Method
getSetterMethod(Method annotated, U annotation)
Returns the setter method responsible for setting the resource identified by the passed annotation on the passed annotated method.boolean
isOptional(AnnotatedElement annotated, U annotation)
Returns true if the resolution of this injection identified by the passed annotation instance is optional-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jvnet.hk2.config.InjectionResolverQuery
getValue
-
-
-
-
Field Detail
-
type
public final Class<U extends Annotation> type
-
-
Method Detail
-
getSetterMethod
public Method getSetterMethod(Method annotated, U annotation)
Returns the setter method responsible for setting the resource identified by the passed annotation on the passed annotated method. This is useful when the annotation is specified on the getter for instance (due to external specification requirements for instance) while the setter should be used if values must be set using this injection resolver. By default, the setter method is the annotated method.- Parameters:
annotated
- is the annotatedMethod
annotation
- the annotation on the method- Returns:
- the setter method to use for injecting the annotation identified resource
-
isOptional
public boolean isOptional(AnnotatedElement annotated, U annotation)
Returns true if the resolution of this injection identified by the passed annotation instance is optional
-
-