Class AnnotatedMethod
- java.lang.Object
-
- org.glassfish.jersey.server.model.AnnotatedMethod
-
- All Implemented Interfaces:
java.lang.reflect.AnnotatedElement
public final class AnnotatedMethod extends java.lang.Object implements java.lang.reflect.AnnotatedElement
Annotated method representation.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.Method
am
private java.lang.reflect.Method
m
private static java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>>
METHOD_ANNOTATIONS
private static java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>>
METHOD_META_ANNOTATIONS
private java.lang.annotation.Annotation[]
methodAnnotations
private static java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>>
PARAMETER_ANNOTATIONS
private java.lang.annotation.Annotation[][]
parameterAnnotations
-
Constructor Summary
Constructors Constructor Description AnnotatedMethod(java.lang.reflect.Method method)
Create annotated method instance from theJava method
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static boolean
annotationNotInList(java.lang.Class<? extends java.lang.annotation.Annotation> ca, java.util.List<java.lang.annotation.Annotation> la)
private static <T> java.util.List<T>
asList(T... ts)
private static java.lang.reflect.Method
findAnnotatedMethod(java.lang.Class<?> c, java.lang.reflect.Method m)
private static java.lang.reflect.Method
findAnnotatedMethod(java.lang.reflect.Method m)
<T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.Class<T> annotationType)
java.lang.annotation.Annotation[]
getAnnotations()
java.lang.annotation.Annotation[]
getDeclaredAnnotations()
(package private) java.lang.reflect.Method
getDeclaredMethod()
Get the underlying declared Java method.java.lang.reflect.Type[]
getGenericParameterTypes()
Get generic method parameter types.<T extends java.lang.annotation.Annotation>
java.util.List<T>getMetaMethodAnnotations(java.lang.Class<T> annotation)
Get all instances of the specified meta-annotation type found on the method annotations.java.lang.reflect.Method
getMethod()
Get the underlying Java method.java.lang.annotation.Annotation[][]
getParameterAnnotations()
Get method parameter annotations.java.lang.Class<?>[]
getParameterTypes()
Get method parameter types.private static java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>>
getSet(java.lang.Class<? extends java.lang.annotation.Annotation>... cs)
java.lang.reflect.TypeVariable<java.lang.reflect.Method>[]
getTypeParameters()
Get method type parameters.private static boolean
hasAnnotations(java.lang.reflect.Method m)
private static boolean
hasMetaMethodAnnotations(java.lang.reflect.Method m)
private static boolean
hasMethodAnnotations(java.lang.reflect.Method m)
private static boolean
hasParameterAnnotations(java.lang.reflect.Method m)
boolean
isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
private static java.lang.annotation.Annotation[]
mergeMethodAnnotations(java.lang.reflect.Method m, java.lang.reflect.Method am)
private static java.lang.annotation.Annotation[][]
mergeParameterAnnotations(java.lang.reflect.Method m, java.lang.reflect.Method am)
java.lang.String
toString()
-
-
-
Field Detail
-
METHOD_META_ANNOTATIONS
private static final java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> METHOD_META_ANNOTATIONS
-
METHOD_ANNOTATIONS
private static final java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> METHOD_ANNOTATIONS
-
PARAMETER_ANNOTATIONS
private static final java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> PARAMETER_ANNOTATIONS
-
m
private final java.lang.reflect.Method m
-
am
private final java.lang.reflect.Method am
-
methodAnnotations
private final java.lang.annotation.Annotation[] methodAnnotations
-
parameterAnnotations
private final java.lang.annotation.Annotation[][] parameterAnnotations
-
-
Method Detail
-
getSet
@SafeVarargs private static java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> getSet(java.lang.Class<? extends java.lang.annotation.Annotation>... cs)
-
getMethod
public java.lang.reflect.Method getMethod()
Get the underlying Java method.- Returns:
- the underlying Java method.
-
getDeclaredMethod
java.lang.reflect.Method getDeclaredMethod()
Get the underlying declared Java method. This method overrides or is the same as the one retrieved bygetMethod
.- Returns:
- the underlying declared Java method.
-
getParameterAnnotations
public java.lang.annotation.Annotation[][] getParameterAnnotations()
Get method parameter annotations.- Returns:
- method parameter annotations.
-
getParameterTypes
public java.lang.Class<?>[] getParameterTypes()
Get method parameter types. See alsoMethod.getParameterTypes()
.- Returns:
- method parameter types.
-
getTypeParameters
public java.lang.reflect.TypeVariable<java.lang.reflect.Method>[] getTypeParameters()
Get method type parameters. See alsoMethod.getTypeParameters()
.- Returns:
- method type parameters.
-
getGenericParameterTypes
public java.lang.reflect.Type[] getGenericParameterTypes()
Get generic method parameter types. See alsoMethod.getGenericParameterTypes()
.- Returns:
- generic method parameter types.
-
getMetaMethodAnnotations
public <T extends java.lang.annotation.Annotation> java.util.List<T> getMetaMethodAnnotations(java.lang.Class<T> annotation)
Get all instances of the specified meta-annotation type found on the method annotations.- Type Parameters:
T
- meta-annotation type.- Parameters:
annotation
- meta-annotation class to be searched for.- Returns:
- meta-annotation instances of a given type annotating the method annotations.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isAnnotationPresent
public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
- Specified by:
isAnnotationPresent
in interfacejava.lang.reflect.AnnotatedElement
-
getAnnotation
public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> annotationType)
- Specified by:
getAnnotation
in interfacejava.lang.reflect.AnnotatedElement
-
getAnnotations
public java.lang.annotation.Annotation[] getAnnotations()
- Specified by:
getAnnotations
in interfacejava.lang.reflect.AnnotatedElement
-
getDeclaredAnnotations
public java.lang.annotation.Annotation[] getDeclaredAnnotations()
- Specified by:
getDeclaredAnnotations
in interfacejava.lang.reflect.AnnotatedElement
-
mergeMethodAnnotations
private static java.lang.annotation.Annotation[] mergeMethodAnnotations(java.lang.reflect.Method m, java.lang.reflect.Method am)
-
mergeParameterAnnotations
private static java.lang.annotation.Annotation[][] mergeParameterAnnotations(java.lang.reflect.Method m, java.lang.reflect.Method am)
-
annotationNotInList
private static boolean annotationNotInList(java.lang.Class<? extends java.lang.annotation.Annotation> ca, java.util.List<java.lang.annotation.Annotation> la)
-
findAnnotatedMethod
private static java.lang.reflect.Method findAnnotatedMethod(java.lang.reflect.Method m)
-
findAnnotatedMethod
private static java.lang.reflect.Method findAnnotatedMethod(java.lang.Class<?> c, java.lang.reflect.Method m)
-
hasAnnotations
private static boolean hasAnnotations(java.lang.reflect.Method m)
-
hasMetaMethodAnnotations
private static boolean hasMetaMethodAnnotations(java.lang.reflect.Method m)
-
hasMethodAnnotations
private static boolean hasMethodAnnotations(java.lang.reflect.Method m)
-
hasParameterAnnotations
private static boolean hasParameterAnnotations(java.lang.reflect.Method m)
-
asList
@SafeVarargs private static <T> java.util.List<T> asList(T... ts)
-
-