public class

DependencyDescriptor

extends Object
implements Serializable
java.lang.Object
   ↳ org.springframework.beans.factory.config.DependencyDescriptor

Class Overview

Descriptor for a specific dependency that is about to be injected. Wraps a constructor parameter, a method parameter or a field, allowing unified access to their metadata.

Summary

Public Constructors
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.
DependencyDescriptor(Field field, boolean required)
Create a new descriptor for a field.
DependencyDescriptor(Field field, boolean required, boolean eager)
Create a new descriptor for a field.
Public Methods
Annotation[] getAnnotations()
Obtain the annotations associated with the wrapped parameter/field, if any.
Class<?> getCollectionType()
Determine the generic element type of the wrapped Collection parameter/field, if any.
String getDependencyName()
Determine the name of the wrapped parameter/field.
Class<?> getDependencyType()
Determine the declared (non-generic) type of the wrapped parameter/field.
Field getField()
Return the wrapped Field, if any.
Type getGenericDependencyType()
Determine the generic type of the wrapped parameter/field.
Class<?> getMapKeyType()
Determine the generic key type of the wrapped Map parameter/field, if any.
Class<?> getMapValueType()
Determine the generic value type of the wrapped Map parameter/field, if any.
MethodParameter getMethodParameter()
Return the wrapped MethodParameter, if any.
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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public DependencyDescriptor (MethodParameter methodParameter, boolean required)

Create a new descriptor for a method or constructor parameter. Considers the dependency as 'eager'.

Parameters
methodParameter the MethodParameter to wrap
required whether the dependency is required

public DependencyDescriptor (MethodParameter methodParameter, boolean required, boolean eager)

Create a new descriptor for a method or constructor parameter.

Parameters
methodParameter the MethodParameter to wrap
required whether the dependency is required
eager whether this dependency is 'eager' in the sense of eagerly resolving potential target beans for type matching

public DependencyDescriptor (Field field, boolean required)

Create a new descriptor for a field. Considers the dependency as 'eager'.

Parameters
field the field to wrap
required whether the dependency is required

public DependencyDescriptor (Field field, boolean required, boolean eager)

Create a new descriptor for a field.

Parameters
field the field to wrap
required whether the dependency is required
eager whether this dependency is 'eager' in the sense of eagerly resolving potential target beans for type matching

Public Methods

public Annotation[] getAnnotations ()

Also: SpringBeans

Obtain the annotations associated with the wrapped parameter/field, if any.

public Class<?> getCollectionType ()

Also: SpringBeans

Determine the generic element type of the wrapped Collection parameter/field, if any.

Returns
  • the generic type, or null if none

public String getDependencyName ()

Also: SpringBeans

Determine the name of the wrapped parameter/field.

Returns
  • the declared name (never null)

public Class<?> getDependencyType ()

Also: SpringBeans

Determine the declared (non-generic) type of the wrapped parameter/field.

Returns
  • the declared type (never null)

public Field getField ()

Also: SpringBeans

Return the wrapped Field, if any.

Note: Either MethodParameter or Field is available.

Returns
  • the Field, or null if none

public Type getGenericDependencyType ()

Also: SpringBeans

Determine the generic type of the wrapped parameter/field.

Returns
  • the generic type (never null)

public Class<?> getMapKeyType ()

Also: SpringBeans

Determine the generic key type of the wrapped Map parameter/field, if any.

Returns
  • the generic type, or null if none

public Class<?> getMapValueType ()

Also: SpringBeans

Determine the generic value type of the wrapped Map parameter/field, if any.

Returns
  • the generic type, or null if none

public MethodParameter getMethodParameter ()

Also: SpringBeans

Return the wrapped MethodParameter, if any.

Note: Either MethodParameter or Field is available.

Returns
  • the MethodParameter, or null if none

public void initParameterNameDiscovery (ParameterNameDiscoverer parameterNameDiscoverer)

Initialize parameter name discovery for the underlying method parameter, if any.

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 boolean isEager ()

Also: SpringBeans

Return whether this dependency is 'eager' in the sense of eagerly resolving potential target beans for type matching.

public boolean isRequired ()

Also: SpringBeans

Return whether this dependency is required.