Method handle, providing deep annotation
introspection on methods and method parameters, including the exposure of
interface-declared parameter annotations from the concrete target method.
getMethodAnnotation(Class), getMethodParameters(), AnnotatedElementUtils, SynthesizingMethodParameter
| Modifier and Type | Class and Description |
|---|---|
| protected class | AnnotatedMethod.
A MethodParameter with AnnotatedMethod-specific behavior. |
| private class | AnnotatedMethod.
A MethodParameter for an AnnotatedMethod return type based on an actual return value. |
| Modifier and Type | Field and Description |
|---|---|
| private final Method | |
| private volatile List | |
| private final Method | |
| private final MethodParameter[] |
| Access | Constructor and Description |
|---|---|
| public | AnnotatedMethod(Method
the method)Method handle to wrapCreate an instance that wraps the given |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| 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 Object | |
| protected static String | |
| protected final Method | getBridgedMethod()
If the annotated method is a bridge method, this method returns the bridged (user-defined) method. |
| protected Class | |
| private List | |
| public final Method | |
| public <A extends Annotation> A | Returns: the annotation, ornull if none foundthe annotation type to look for annotationType)Return a single annotation on the underlying method, traversing its super methods if no annotation can be found on the given method itself. |
| public final MethodParameter[] | |
| public MethodParameter | |
| public MethodParameter | |
| public int | |
| public <A extends Annotation> boolean | hasMethodAnnotation(Class<A>
the annotation type to look for annotationType)Determine if an annotation of the given type is present or meta-present on the method. |
| private MethodParameter[] | |
| private boolean | |
| public boolean | |
| public String |
| bridgedMethod | back to summary |
|---|---|
| private final Method bridgedMethod | |
| inheritedParameterAnnotations | back to summary |
|---|---|
| private volatile List<Annotation[][]> inheritedParameterAnnotations
| |
| method | back to summary |
|---|---|
| private final Method method | |
| parameters | back to summary |
|---|---|
| private final MethodParameter[] parameters | |
| AnnotatedMethod | back to summary |
|---|---|
| public AnnotatedMethod(Method method) Create an instance that wraps the given
| |
| AnnotatedMethod | back to summary |
|---|---|
| protected AnnotatedMethod(AnnotatedMethod annotatedMethod) Copy constructor for use in subclasses. | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| findProvidedArgument | back to summary |
|---|---|
protected static Object findProvidedArgument(MethodParameter parameter, Object... providedArgs)
| |
| formatArgumentError | back to summary |
|---|---|
| protected static String formatArgumentError(MethodParameter param, String message) | |
| getBridgedMethod | back to summary |
|---|---|
| protected final Method getBridgedMethod() If the annotated method is a bridge method, this method returns the bridged
(user-defined) method. Otherwise, it returns the same method as | |
| getContainingClass | back to summary |
|---|---|
| protected Class Expose the containing class for method parameters.
| |
| getInheritedParameterAnnotations | back to summary |
|---|---|
| private List | |
| getMethod | back to summary |
|---|---|
| public final Method getMethod() Return the annotated method. | |
| getMethodAnnotation | back to summary |
|---|---|
| public <A extends Annotation> A getMethodAnnotation(Class<A> annotationType) Return a single annotation on the underlying method, traversing its super methods if no annotation can be found on the given method itself. Supports merged composed annotations with attribute overrides.
| |
| getMethodParameters | back to summary |
|---|---|
| public final MethodParameter[] getMethodParameters() Return the method parameters for this | |
| getReturnType | back to summary |
|---|---|
| public MethodParameter getReturnType() Return a | |
| getReturnValueType | back to summary |
|---|---|
| public MethodParameter getReturnValueType(Object returnValue) Return a | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| hasMethodAnnotation | back to summary |
|---|---|
| public <A extends Annotation> boolean hasMethodAnnotation(Class<A> annotationType) Determine if an annotation of the given type is present or meta-present on the method.
| |
| initMethodParameters | back to summary |
|---|---|
| private MethodParameter[] initMethodParameters() | |
| isOverrideFor | back to summary |
|---|---|
| private boolean isOverrideFor(Method candidate) | |
| isVoid | back to summary |
|---|---|
| public boolean isVoid() Return | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Modifier and Type | Field and Description |
|---|---|
| private volatile Annotation[] |
| Access | Constructor and Description |
|---|---|
| public | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public AnnotatedMethod. | clone()
Overrides org. Creates and returns a copy of this object. |
| public Class | getContainingClass()
Overrides org. Return the containing class for this method parameter. |
| public Method | getMethod()
Overrides org. Return the wrapped Method, if any. |
| public <T extends Annotation> T | getMethodAnnotation(Class<T>
the annotation type to look for annotationType)Overrides org. Return the method/constructor annotation of the given type, if available. |
| public Annotation[] | getParameterAnnotations()
Overrides org. Return the annotations associated with the specific method/constructor parameter. |
| public <T extends Annotation> boolean | hasMethodAnnotation(Class<T>
the annotation type to look for annotationType)Overrides org. Return whether the method/constructor is annotated with the given type. |
| combinedAnnotations | back to summary |
|---|---|
| private volatile Annotation[] combinedAnnotations
| |
| AnnotatedMethodParameter | back to summary |
|---|---|
| public AnnotatedMethodParameter(int index) | |
| AnnotatedMethodParameter | back to summary |
|---|---|
| protected AnnotatedMethodParameter(AnnotatedMethod. | |
| clone | back to summary |
|---|---|
| public AnnotatedMethod. Overrides org. Doc from java. 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 will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
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
| |
| getContainingClass | back to summary |
|---|---|
| public Class Overrides org. Doc from org. Return the containing class for this method parameter. | |
| getMethod | back to summary |
|---|---|
| public Method getMethod() Overrides org. Doc from org. Return the wrapped Method, if any. Note Either Method or Constructor is available. | |
| getMethodAnnotation | back to summary |
|---|---|
| public <T extends Annotation> T getMethodAnnotation(Class<T> annotationType) Overrides org. Doc from org. Return the method/constructor annotation of the given type, if available. | |
| getParameterAnnotations | back to summary |
|---|---|
| public Annotation[] getParameterAnnotations() Overrides org. Doc from org. Return the annotations associated with the specific method/constructor parameter.
| |
| hasMethodAnnotation | back to summary |
|---|---|
| public <T extends Annotation> boolean hasMethodAnnotation(Class<T> annotationType) Overrides org. Doc from org. Return whether the method/constructor is annotated with the given type. | |
| Modifier and Type | Field and Description |
|---|---|
| private final Class |
| Access | Constructor and Description |
|---|---|
| public | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public AnnotatedMethod. | clone()
Overrides org. Creates and returns a copy of this object. |
| public Class | getParameterType()
Overrides org. Return the type of the method/constructor parameter. |
| returnValueType | back to summary |
|---|---|
| private final Class<?> returnValueType
| |
| ReturnValueMethodParameter | back to summary |
|---|---|
| public ReturnValueMethodParameter(Object returnValue) | |
| ReturnValueMethodParameter | back to summary |
|---|---|
| protected ReturnValueMethodParameter(AnnotatedMethod. | |
| clone | back to summary |
|---|---|
| public AnnotatedMethod. Overrides org. Doc from java. 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 will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
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
| |
| getParameterType | back to summary |
|---|---|
| public Class Overrides org. Doc from org. Return the type of the method/constructor parameter. | |