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.AnnotatedElementAnnotated method representation.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.Methodamprivate java.lang.reflect.Methodmprivate static java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>>METHOD_ANNOTATIONSprivate static java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>>METHOD_META_ANNOTATIONSprivate java.lang.annotation.Annotation[]methodAnnotationsprivate static java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>>PARAMETER_ANNOTATIONSprivate 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 booleanannotationNotInList(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.MethodfindAnnotatedMethod(java.lang.Class<?> c, java.lang.reflect.Method m)private static java.lang.reflect.MethodfindAnnotatedMethod(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.MethodgetDeclaredMethod()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.MethodgetMethod()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 booleanhasAnnotations(java.lang.reflect.Method m)private static booleanhasMetaMethodAnnotations(java.lang.reflect.Method m)private static booleanhasMethodAnnotations(java.lang.reflect.Method m)private static booleanhasParameterAnnotations(java.lang.reflect.Method m)booleanisAnnotationPresent(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.StringtoString()
-
-
-
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:
toStringin classjava.lang.Object
-
isAnnotationPresent
public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
- Specified by:
isAnnotationPresentin interfacejava.lang.reflect.AnnotatedElement
-
getAnnotation
public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> annotationType)
- Specified by:
getAnnotationin interfacejava.lang.reflect.AnnotatedElement
-
getAnnotations
public java.lang.annotation.Annotation[] getAnnotations()
- Specified by:
getAnnotationsin interfacejava.lang.reflect.AnnotatedElement
-
getDeclaredAnnotations
public java.lang.annotation.Annotation[] getDeclaredAnnotations()
- Specified by:
getDeclaredAnnotationsin 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)
-
-