Method
or Constructor plus a parameter index and a nested type index for a declared generic
type. Useful as a specification object to pass along.
As of 4.2, there is a org.
subclass available which synthesizes annotations with attribute aliases. That subclass is used
for web and message endpoint processing, in particular.
org.springframework.core.annotation.SynthesizingMethodParameter
| Modifier and Type | Class and Description |
|---|---|
| private static class | MethodParameter.
|
| private static class | MethodParameter.
Inner class to avoid a hard dependency on Kotlin at runtime. |
| Modifier and Type | Field and Description |
|---|---|
| private volatile Class | containingClass
The containing class. |
| private static final Annotation[] | |
| private final Executable | |
| private volatile Type | |
| private volatile MethodParameter | |
| private int | |
| private volatile Parameter | |
| private volatile Annotation[] | |
| private final int | |
| pack-priv volatile String | |
| private volatile ParameterNameDiscoverer | |
| private volatile Class | |
| pack-priv Map | typeIndexesPerLevel
Map from Integer level to Integer type index. |
| Access | Constructor and Description |
|---|---|
| public | MethodParameter(Method
the Method to specify a parameter for method, int the index of the parameter: -1 for the method
return type; 0 for the first method parameter; 1 for the second method
parameter, etc. parameterIndex)Create a new |
| public | MethodParameter(Method
the Method to specify a parameter for method, int the index of the parameter: -1 for the method
return type; 0 for the first method parameter; 1 for the second method
parameter, etc. parameterIndex, int the nesting level of the target type
(typically 1; e.g. in case of a List of Lists, 1 would indicate the
nested List, whereas 2 would indicate the element of the nested List) nestingLevel)Create a new |
| public | MethodParameter(Constructor<?>
the Constructor to specify a parameter for constructor, int the index of the parameter parameterIndex)Create a new MethodParameter for the given constructor, with nesting level 1. |
| public | MethodParameter(Constructor<?>
the Constructor to specify a parameter for constructor, int the index of the parameter parameterIndex, int the nesting level of the target type
(typically 1; e.g. in case of a List of Lists, 1 would indicate the
nested List, whereas 2 would indicate the element of the nested List) nestingLevel)Create a new MethodParameter for the given constructor. |
| pack-priv | MethodParameter(Executable
the Executable to specify a parameter for executable, int the index of the parameter parameterIndex, Class<?> the containing class containingClass)Internal constructor used to create a |
| public | MethodParameter(MethodParameter
the original MethodParameter object to copy from original)Copy constructor, resulting in an independent MethodParameter object based on the same metadata and cache state that the original object was in. |
| Modifier and Type | Method and Description |
|---|---|
| protected <A extends Annotation> A | Returns: the post-processed annotation (or simply the original one)the annotation about to be returned annotation)A template method to post-process a given annotation instance before returning it to the caller. |
| protected Annotation[] | Returns: the post-processed annotation array (or simply the original one)the annotation array about to be returned annotations)A template method to post-process a given annotation array before returning it to the caller. |
| public MethodParameter | |
| private Class | |
| public void | decreaseNestingLevel()
Deprecated
since 5.2 in favor of retaining the original MethodParameter and
using
nested(Integer) if nesting is required
Decrease this parameter's nesting level. |
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. Indicates whether some other object is "equal to" this one. |
| protected static int | |
| public static MethodParameter | Returns: the corresponding MethodParameter instancethe Method or Constructor to specify a parameter for executable, int the index of the parameter parameterIndex)Create a new MethodParameter for the given method or constructor. |
| public static MethodParameter | Returns: the corresponding MethodParameter instancethe Constructor to specify a parameter for ctor, int the index of the parameter parameterIndex, String the name of the underlying field,
matching the constructor's parameter name fieldName)Create a new MethodParameter for the given field-aware constructor, e.g. on a data class or record type. |
| public static MethodParameter | Returns: the corresponding MethodParameter instancethe Method or Constructor to specify a parameter for methodOrConstructor, int the index of the parameter parameterIndex)
Deprecated
as of 5.0, in favor of
forExecutable
Create a new MethodParameter for the given method or constructor. |
| public static MethodParameter | Returns: the corresponding MethodParameter instancethe parameter descriptor parameter)Create a new MethodParameter for the given parameter descriptor. |
| public AnnotatedElement | Returns: the Method or Constructor as AnnotatedElementReturn the wrapped annotated element. |
| public Constructor | |
| public Class | Returns: a specific containing class (potentially a subclass of the declaring class), or otherwise simply the declaring class itselfReturn the containing class for this method parameter. |
| public Class | |
| public Executable | |
| public Type | Returns: the parameter type (nevernull)Return the generic type of the method/constructor parameter. |
| public Member | |
| public Method | |
| public <A extends Annotation> A | Returns: the annotation object, ornull if not foundthe annotation type to look for annotationType)Return the method/constructor annotation of the given type, if available. |
| public Annotation[] | |
| public Type | Returns: the parameter type (nevernull)Return the nested generic type of the method/constructor parameter. |
| public Class | Returns: the parameter type (nevernull)Return the nested type of the method/constructor parameter. |
| public int | getNestingLevel()
Return the nesting level of the target type (typically 1; e.g. in case of a List of Lists, 1 would indicate the nested List, whereas 2 would indicate the element of the nested List). |
| public Parameter | |
| public <A extends Annotation> A | Returns: the annotation object, ornull if not foundthe annotation type to look for annotationType)Return the parameter annotation of the given type, if available. |
| public Annotation[] | getParameterAnnotations()
Return the annotations associated with the specific method/constructor parameter. |
| public int | Returns: the parameter index (-1 in case of the return type)Return the index of the method/constructor parameter. |
| public String | Returns: the parameter name (may benull if no
parameter name metadata is contained in the class file or no
ParameterNameDiscoverer
has been set to begin with)Return the name of the method/constructor parameter. |
| public Class | Returns: the parameter type (nevernull)Return the type of the method/constructor parameter. |
| private Map | |
| public Integer | Returns: the corresponding type index, ornull
if none specified (indicating the default type index)Return the type index for the current nesting level. |
| public Integer | Returns: the corresponding type index, ornull
if none specified (indicating the default type index)the nesting level to check nestingLevel)Return the type index for the specified nesting level. |
| public int | |
| public <A extends Annotation> boolean | hasMethodAnnotation(Class<A>
the annotation type to look for annotationType)Return whether the method/constructor is annotated with the given type. |
| private boolean | hasNullableAnnotation()
Check whether this method parameter is annotated with any variant of a
|
| public <A extends Annotation> boolean | hasParameterAnnotation(Class<A>
the annotation type to look for annotationType)Return whether the parameter is declared with the given annotation type. |
| public boolean | hasParameterAnnotations()
Return |
| public void | increaseNestingLevel()
Deprecated
since 5.2 in favor of
nested(Integer)
Increase this parameter's nesting level. |
| public void | initParameterNameDiscovery(ParameterNameDiscoverer parameterNameDiscoverer)
Initialize parameter name discovery for this method parameter. |
| public boolean | isOptional()
Return whether this method indicates a parameter which is not required:
either in the form of Java 8's |
| public MethodParameter | nested()
Return a variant of this |
| public MethodParameter | |
| private MethodParameter | |
| public MethodParameter | nestedIfOptional()
Return a variant of this |
| pack-priv void | setContainingClass(Class<?> containingClass)
Deprecated
Set a containing class to resolve the parameter type against. |
| pack-priv void | |
| public void | setTypeIndexForCurrentLevel(int
the corresponding type index
(or typeIndex)null for the default type index)
Deprecated
since 5.2 in favor of
withTypeIndex
Set the type index for the current nesting level. |
| public String | |
| private static int | |
| public MethodParameter | withContainingClass(Class<?>
a specific containing class (potentially a
subclass of the declaring class, e.g. substituting a type variable) containingClass)Return a variant of this |
| public MethodParameter | withTypeIndex(int
the new type index typeIndex)Return a variant of this |