public class DependencyDescriptor
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private java.lang.Class<?> |
containingClass |
private java.lang.Class<?> |
declaringClass |
private boolean |
eager |
private java.lang.reflect.Field |
field |
private java.lang.annotation.Annotation[] |
fieldAnnotations |
private java.lang.String |
fieldName |
private java.lang.String |
methodName |
private MethodParameter |
methodParameter |
private int |
nestingLevel |
private int |
parameterIndex |
private java.lang.Class<?>[] |
parameterTypes |
private boolean |
required |
Constructor and Description |
---|
DependencyDescriptor(DependencyDescriptor original)
Copy constructor.
|
DependencyDescriptor(java.lang.reflect.Field field,
boolean required)
Create a new descriptor for a field.
|
DependencyDescriptor(java.lang.reflect.Field field,
boolean required,
boolean eager)
Create a new descriptor for a field.
|
DependencyDescriptor(MethodParameter methodParameter,
boolean required)
Create a new descriptor for a method or constructor parameter.
|
DependencyDescriptor(MethodParameter methodParameter,
boolean required,
boolean eager)
Create a new descriptor for a method or constructor parameter.
|
Modifier and Type | Method and Description |
---|---|
boolean |
fallbackMatchAllowed()
Return whether a fallback match is allowed.
|
DependencyDescriptor |
forFallbackMatch()
Return a variant of this descriptor that is intended for a fallback match.
|
java.lang.annotation.Annotation[] |
getAnnotations()
Obtain the annotations associated with the wrapped parameter/field, if any.
|
java.lang.Class<?> |
getCollectionType()
Determine the generic element type of the wrapped Collection parameter/field, if any.
|
java.lang.String |
getDependencyName()
Determine the name of the wrapped parameter/field.
|
java.lang.Class<?> |
getDependencyType()
Determine the declared (non-generic) type of the wrapped parameter/field.
|
java.lang.reflect.Field |
getField()
Return the wrapped Field, if any.
|
java.lang.Class<?> |
getMapKeyType()
Determine the generic key type of the wrapped Map parameter/field, if any.
|
java.lang.Class<?> |
getMapValueType()
Determine the generic value type of the wrapped Map parameter/field, if any.
|
MethodParameter |
getMethodParameter()
Return the wrapped MethodParameter, if any.
|
ResolvableType |
getResolvableType()
Build a ResolvableType object for the wrapped parameter/field.
|
void |
increaseNestingLevel()
Increase this descriptor's nesting level.
|
void |
initParameterNameDiscovery(ParameterNameDiscoverer parameterNameDiscoverer)
Initialize parameter name discovery for the underlying method parameter, if any.
|
boolean |
isEager()
Return whether this dependency is 'eager' in the sense of
eagerly resolving potential target beans for type matching.
|
boolean |
isRequired()
Return whether this dependency is required.
|
private void |
readObject(java.io.ObjectInputStream ois) |
void |
setContainingClass(java.lang.Class<?> containingClass)
Optionally set the concrete class that contains this dependency.
|
private transient MethodParameter methodParameter
private transient java.lang.reflect.Field field
private java.lang.Class<?> declaringClass
private java.lang.Class<?> containingClass
private java.lang.String methodName
private java.lang.Class<?>[] parameterTypes
private int parameterIndex
private java.lang.String fieldName
private final boolean required
private final boolean eager
private int nestingLevel
private transient java.lang.annotation.Annotation[] fieldAnnotations
public DependencyDescriptor(MethodParameter methodParameter, boolean required)
methodParameter
- the MethodParameter to wraprequired
- whether the dependency is requiredpublic DependencyDescriptor(MethodParameter methodParameter, boolean required, boolean eager)
methodParameter
- the MethodParameter to wraprequired
- whether the dependency is requiredeager
- whether this dependency is 'eager' in the sense of
eagerly resolving potential target beans for type matchingpublic DependencyDescriptor(java.lang.reflect.Field field, boolean required)
field
- the field to wraprequired
- whether the dependency is requiredpublic DependencyDescriptor(java.lang.reflect.Field field, boolean required, boolean eager)
field
- the field to wraprequired
- whether the dependency is requiredeager
- whether this dependency is 'eager' in the sense of
eagerly resolving potential target beans for type matchingpublic DependencyDescriptor(DependencyDescriptor original)
original
- the original descriptor to create a copy frompublic MethodParameter getMethodParameter()
Note: Either MethodParameter or Field is available.
null
if nonepublic java.lang.reflect.Field getField()
Note: Either MethodParameter or Field is available.
null
if nonepublic boolean isRequired()
public boolean isEager()
public void increaseNestingLevel()
MethodParameter.increaseNestingLevel()
public void setContainingClass(java.lang.Class<?> containingClass)
public ResolvableType getResolvableType()
public boolean fallbackMatchAllowed()
This is false
by default but may be overridden to return true
in order
to suggest to a AutowireCandidateResolver
that a fallback match is acceptable as well.
public DependencyDescriptor forFallbackMatch()
fallbackMatchAllowed()
public void initParameterNameDiscovery(ParameterNameDiscoverer parameterNameDiscoverer)
This method does not actually try to retrieve the parameter name at
this point; it just allows discovery to happen when the application calls
getDependencyName()
(if ever).
public java.lang.String getDependencyName()
null
)public java.lang.Class<?> getDependencyType()
null
)public java.lang.Class<?> getCollectionType()
null
if nonepublic java.lang.Class<?> getMapKeyType()
null
if nonepublic java.lang.Class<?> getMapValueType()
null
if nonepublic java.lang.annotation.Annotation[] getAnnotations()
private void readObject(java.io.ObjectInputStream ois) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException