Class InjectionPoint
java.lang.Object
org.springframework.beans.factory.InjectionPoint
- Direct Known Subclasses:
DependencyDescriptor
A simple descriptor for an injection point, pointing to a method/constructor
parameter or a field.
Exposed by UnsatisfiedDependencyException. Also available as an
argument for factory methods, reacting to the requesting injection point
for building a customized bean instance.
- Since:
- 4.3
- Author:
- Juergen Hoeller
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Fieldprotected org.springframework.core.MethodParameter -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJust available for serialization purposes in subclasses.InjectionPoint(Field field) Create an injection point descriptor for a field.protectedInjectionPoint(InjectionPoint original) Copy constructor.InjectionPoint(org.springframework.core.MethodParameter methodParameter) Create an injection point descriptor for a method or constructor parameter. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturn the wrapped annotated element.<A extends Annotation>
AgetAnnotation(Class<A> annotationType) Retrieve a field/parameter annotation of the given type, if any.Obtain the annotations associated with the wrapped field or method/constructor parameter.Class<?>Return the type declared by the underlying field or method/constructor parameter, indicating the injection type.getField()Return the wrapped Field, if any.Returns the wrapped member, containing the injection point.org.springframework.core.MethodParameterReturn the wrapped MethodParameter, if any.inthashCode()protected final org.springframework.core.MethodParameterReturn the wrapped MethodParameter, assuming it is present.toString()
-
Field Details
-
methodParameter
@Nullable protected org.springframework.core.MethodParameter methodParameter -
field
-
-
Constructor Details
-
InjectionPoint
public InjectionPoint(org.springframework.core.MethodParameter methodParameter) Create an injection point descriptor for a method or constructor parameter.- Parameters:
methodParameter- the MethodParameter to wrap
-
InjectionPoint
Create an injection point descriptor for a field.- Parameters:
field- the field to wrap
-
InjectionPoint
Copy constructor.- Parameters:
original- the original descriptor to create a copy from
-
InjectionPoint
protected InjectionPoint()Just available for serialization purposes in subclasses.
-
-
Method Details
-
getMethodParameter
@Nullable public org.springframework.core.MethodParameter getMethodParameter()Return the wrapped MethodParameter, if any.Note: Either MethodParameter or Field is available.
- Returns:
- the MethodParameter, or
nullif none
-
getField
Return the wrapped Field, if any.Note: Either MethodParameter or Field is available.
- Returns:
- the Field, or
nullif none
-
obtainMethodParameter
protected final org.springframework.core.MethodParameter obtainMethodParameter()Return the wrapped MethodParameter, assuming it is present.- Returns:
- the MethodParameter (never
null) - Throws:
IllegalStateException- if no MethodParameter is available- Since:
- 5.0
-
getAnnotations
Obtain the annotations associated with the wrapped field or method/constructor parameter. -
getAnnotation
Retrieve a field/parameter annotation of the given type, if any.- Parameters:
annotationType- the annotation type to retrieve- Returns:
- the annotation instance, or
nullif none found - Since:
- 4.3.9
-
getDeclaredType
Return the type declared by the underlying field or method/constructor parameter, indicating the injection type. -
getMember
Returns the wrapped member, containing the injection point.- Returns:
- the Field / Method / Constructor as Member
-
getAnnotatedElement
Return the wrapped annotated element.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.- Returns:
- the Field / Method / Constructor as AnnotatedElement
-
equals
-
hashCode
public int hashCode() -
toString
-