public class InjectionPoint extends Object
UnsatisfiedDependencyException
.
Also available as an argument for factory methods, reacting to the
requesting injection point for building a customized bean instance.UnsatisfiedDependencyException.getInjectionPoint()
,
DependencyDescriptor
Modifier and Type | Field and Description |
---|---|
protected Field |
field |
protected MethodParameter |
methodParameter |
Modifier | Constructor and Description |
---|---|
protected |
InjectionPoint()
Just available for serialization purposes in subclasses.
|
|
InjectionPoint(Field field)
Create an injection point descriptor for a field.
|
protected |
InjectionPoint(InjectionPoint original)
Copy constructor.
|
|
InjectionPoint(MethodParameter methodParameter)
Create an injection point descriptor for a method or constructor parameter.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
AnnotatedElement |
getAnnotatedElement()
Return the wrapped annotated element.
|
<A extends Annotation> |
getAnnotation(Class<A> annotationType)
Retrieve a field/parameter annotation of the given type, if any.
|
Annotation[] |
getAnnotations()
Obtain the annotations associated with the wrapped field or method/constructor parameter.
|
Class<?> |
getDeclaredType()
Return the type declared by the underlying field or method/constructor parameter,
indicating the injection type.
|
Field |
getField()
Return the wrapped Field, if any.
|
Member |
getMember()
Returns the wrapped member, containing the injection point.
|
MethodParameter |
getMethodParameter()
Return the wrapped MethodParameter, if any.
|
int |
hashCode() |
protected MethodParameter |
obtainMethodParameter()
Return the wrapped MethodParameter, assuming it is present.
|
String |
toString() |
@Nullable protected MethodParameter methodParameter
public InjectionPoint(MethodParameter methodParameter)
methodParameter
- the MethodParameter to wrappublic InjectionPoint(Field field)
field
- the field to wrapprotected InjectionPoint(InjectionPoint original)
original
- the original descriptor to create a copy fromprotected InjectionPoint()
@Nullable public MethodParameter getMethodParameter()
Note: Either MethodParameter or Field is available.
null
if none@Nullable public Field getField()
Note: Either MethodParameter or Field is available.
null
if noneprotected final MethodParameter obtainMethodParameter()
null
)IllegalStateException
- if no MethodParameter is availablepublic Annotation[] getAnnotations()
@Nullable public <A extends Annotation> A getAnnotation(Class<A> annotationType)
annotationType
- the annotation type to retrievenull
if none foundpublic Class<?> getDeclaredType()
public Member getMember()
public AnnotatedElement getAnnotatedElement()
Note: In case of a method/constructor parameter, this exposes
the annotations declared on the method or constructor itself
(i.e. at the method/constructor level, not at the parameter level).
Use getAnnotations()
to obtain parameter-level annotations in
such a scenario, transparently with corresponding field annotations.