Top Description Constructors Methods
org.springframework.core.annotation

public Class SynthesizingMethodParameter

extends MethodParameter
Class Inheritance
Known Direct Subclasses
org.springframework.core.annotation.AnnotatedMethod.AnnotatedMethodParameter
Imports
java.lang.annotation.Annotation, java.lang.reflect.Constructor, .Executable, .Method, .Parameter, org.springframework.core.MethodParameter

A MethodParameter variant which synthesizes annotations that declare attribute aliases via @AliasFor.
Authors
Juergen Hoeller, Sam Brannen
Since
4.2
See Also
AnnotationUtils#synthesizeAnnotation, AnnotationUtils#synthesizeAnnotationArray

Constructor Summary

AccessConstructor and Description
public
SynthesizingMethodParameter(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 SynthesizingMethodParameter for the given method, with nesting level 1.

public
SynthesizingMethodParameter(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 SynthesizingMethodParameter for the given method.

public
SynthesizingMethodParameter(Constructor<?>
the Constructor to specify a parameter for
constructor
,
int
the index of the parameter
parameterIndex
)

Create a new SynthesizingMethodParameter for the given constructor, with nesting level 1.

public
SynthesizingMethodParameter(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 SynthesizingMethodParameter for the given constructor.

protected
SynthesizingMethodParameter(SynthesizingMethodParameter
the original SynthesizingMethodParameter object to copy from
original
)

Copy constructor, resulting in an independent SynthesizingMethodParameter based on the same metadata and cache state that the original object was in.

Method Summary

Modifier and TypeMethod and Description
protected <A extends Annotation> A
adaptAnnotation(A
the annotation about to be returned
annotation
)

Overrides org.springframework.core.MethodParameter.adaptAnnotation.

A template method to post-process a given annotation instance before returning it to the caller.

protected Annotation[]
adaptAnnotationArray(Annotation[]
the annotation array about to be returned
annotations
)

Overrides org.springframework.core.MethodParameter.adaptAnnotationArray.

A template method to post-process a given annotation array before returning it to the caller.

public SynthesizingMethodParameter
clone()

Overrides org.springframework.core.MethodParameter.clone.

Creates and returns a copy of this object.

public static SynthesizingMethodParameter

Returns:

the corresponding SynthesizingMethodParameter instance
forExecutable
(Executable
the Method or Constructor to specify a parameter for
executable
,
int
the index of the parameter
parameterIndex
)

Hides org.springframework.core.MethodParameter.forExecutable.

Create a new SynthesizingMethodParameter for the given method or constructor.

public static SynthesizingMethodParameter

Returns:

the corresponding SynthesizingMethodParameter instance
forParameter
(Parameter
the parameter descriptor
parameter
)

Hides org.springframework.core.MethodParameter.forParameter.

Create a new SynthesizingMethodParameter for the given parameter descriptor.

Inherited from org.springframework.core.MethodParameter:
decreaseNestingLevelequalsfindParameterIndexforFieldAwareConstructorforMethodOrConstructorgetAnnotatedElementgetConstructorgetContainingClassgetDeclaringClassgetExecutablegetGenericParameterTypegetMembergetMethodgetMethodAnnotationgetMethodAnnotationsgetNestedGenericParameterTypegetNestedParameterTypegetNestingLevelgetParametergetParameterAnnotationgetParameterAnnotationsgetParameterIndexgetParameterNamegetParameterTypegetTypeIndexForCurrentLevelgetTypeIndexForLevelhashCodehasMethodAnnotationhasParameterAnnotationhasParameterAnnotationsincreaseNestingLevelinitParameterNameDiscoveryisOptionalnestednestednestedIfOptionalsetTypeIndexForCurrentLeveltoStringwithContainingClasswithTypeIndex

Constructor Detail

SynthesizingMethodParameterback to summary
public SynthesizingMethodParameter(Method method, int parameterIndex)

Create a new SynthesizingMethodParameter for the given method, with nesting level 1.

Parameters
method:Method

the Method to specify a parameter for

parameterIndex: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.

SynthesizingMethodParameterback to summary
public SynthesizingMethodParameter(Method method, int parameterIndex, int nestingLevel)

Create a new SynthesizingMethodParameter for the given method.

Parameters
method:Method

the Method to specify a parameter for

parameterIndex: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.

nestingLevel: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)

SynthesizingMethodParameterback to summary
public SynthesizingMethodParameter(Constructor<?> constructor, int parameterIndex)

Create a new SynthesizingMethodParameter for the given constructor, with nesting level 1.

Parameters
constructor:Constructor<?>

the Constructor to specify a parameter for

parameterIndex:int

the index of the parameter

SynthesizingMethodParameterback to summary
public SynthesizingMethodParameter(Constructor<?> constructor, int parameterIndex, int nestingLevel)

Create a new SynthesizingMethodParameter for the given constructor.

Parameters
constructor:Constructor<?>

the Constructor to specify a parameter for

parameterIndex:int

the index of the parameter

nestingLevel: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)

SynthesizingMethodParameterback to summary
protected SynthesizingMethodParameter(SynthesizingMethodParameter original)

Copy constructor, resulting in an independent SynthesizingMethodParameter based on the same metadata and cache state that the original object was in.

Parameters
original:SynthesizingMethodParameter

the original SynthesizingMethodParameter object to copy from

Method Detail

adaptAnnotationback to summary
protected <A extends Annotation> A adaptAnnotation(A annotation)

Overrides org.springframework.core.MethodParameter.adaptAnnotation.

Doc from org.springframework.core.MethodParameter.adaptAnnotation.

A template method to post-process a given annotation instance before returning it to the caller.

The default implementation simply returns the given annotation as-is.

Parameters
annotation:A

the annotation about to be returned

Returns:A

the post-processed annotation (or simply the original one)

Annotations
@Override
adaptAnnotationArrayback to summary
protected Annotation[] adaptAnnotationArray(Annotation[] annotations)

Overrides org.springframework.core.MethodParameter.adaptAnnotationArray.

Doc from org.springframework.core.MethodParameter.adaptAnnotationArray.

A template method to post-process a given annotation array before returning it to the caller.

The default implementation simply returns the given annotation array as-is.

Parameters
annotations:Annotation[]

the annotation array about to be returned

Returns:Annotation[]

the post-processed annotation array (or simply the original one)

Annotations
@Override
cloneback to summary
public SynthesizingMethodParameter clone()

Overrides org.springframework.core.MethodParameter.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:SynthesizingMethodParameter

a clone of this instance.

Annotations
@Override
forExecutableback to summary
public static SynthesizingMethodParameter forExecutable(Executable executable, int parameterIndex)

Hides org.springframework.core.MethodParameter.forExecutable.

Create a new SynthesizingMethodParameter for the given method or constructor.

This is a convenience factory method for scenarios where a Method or Constructor reference is treated in a generic fashion.

Parameters
executable:Executable

the Method or Constructor to specify a parameter for

parameterIndex:int

the index of the parameter

Returns:SynthesizingMethodParameter

the corresponding SynthesizingMethodParameter instance

Since
5.0
forParameterback to summary
public static SynthesizingMethodParameter forParameter(Parameter parameter)

Hides org.springframework.core.MethodParameter.forParameter.

Create a new SynthesizingMethodParameter for the given parameter descriptor.

This is a convenience factory method for scenarios where a Java 8 Parameter descriptor is already available.

Parameters
parameter:Parameter

the parameter descriptor

Returns:SynthesizingMethodParameter

the corresponding SynthesizingMethodParameter instance

Since
5.0