package org.springframework.beans.factory.config;
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.
- Author(s):
- Juergen Hoeller
- Since:
- 2.5
private final boolean eager;
Create a new descriptor for a method or constructor parameter.
Considers the dependency as 'eager'.
- Parameters:
methodParameter the MethodParameter to wraprequired whether the dependency is required
this(methodParameter, required, true);
Create a new descriptor for a method or constructor parameter.
- Parameters:
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 matching
Assert.notNull(methodParameter, "MethodParameter must not be null");
Create a new descriptor for a field.
Considers the dependency as 'eager'.
- Parameters:
field the field to wraprequired whether the dependency is required
this(field, required, true);
Create a new descriptor for a field.
- Parameters:
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 matching
Assert.notNull(field, "Field must not be null");
Return the wrapped MethodParameter, if any.
Note: Either MethodParameter or Field is available.
- Returns:
- the MethodParameter, or
null if none
Return the wrapped Field, if any.
Note: Either MethodParameter or Field is available.
- Returns:
- the Field, or
null if none
Return whether this dependency is required.
Return whether this dependency is 'eager' in the sense of
eagerly resolving potential target beans for type matching.
Determine the declared (non-generic) type of the wrapped parameter/field.
- Returns:
- the declared type (never
null)
Determine the generic element type of the wrapped Collection parameter/field, if any.
- Returns:
- the generic type, or
null if none
return (this.field != null ?
Determine the generic key type of the wrapped Map parameter/field, if any.
- Returns:
- the generic type, or
null if none
return (this.field != null ?
Determine the generic value type of the wrapped Map parameter/field, if any.
- Returns:
- the generic type, or
null if none
return (this.field != null ?
Obtain the annotations associated with the wrapped parameter/field, if any.
- Returns:
- the parameter/field annotations, or
null if there is
no annotation support (on JDK < 1.5). The return value is an Object array
instead of an Annotation array simply for compatibility with older JDKs;
feel free to cast it to Annotation[] on JDK 1.5 or higher.
if (this.field != null) {