Class AnnotatedMethod

java.lang.Object
org.glassfish.jersey.server.model.AnnotatedMethod
All Implemented Interfaces:
AnnotatedElement

public final class AnnotatedMethod extends Object implements AnnotatedElement
Annotated method representation.
  • Field Details

    • METHOD_META_ANNOTATIONS

      private static final Set<Class<? extends Annotation>> METHOD_META_ANNOTATIONS
    • METHOD_ANNOTATIONS

      private static final Set<Class<? extends Annotation>> METHOD_ANNOTATIONS
    • PARAMETER_ANNOTATIONS

      private static final Set<Class<? extends Annotation>> PARAMETER_ANNOTATIONS
    • m

      private final Method m
    • am

      private final Method am
    • methodAnnotations

      private final Annotation[] methodAnnotations
    • parameterAnnotations

      private final Annotation[][] parameterAnnotations
  • Constructor Details

    • AnnotatedMethod

      public AnnotatedMethod(Method method)
      Create annotated method instance from the Java method.
      Parameters:
      method - Java method.
  • Method Details

    • getSet

      @SafeVarargs private static Set<Class<? extends Annotation>> getSet(Class<? extends Annotation>... cs)
    • getMethod

      public Method getMethod()
      Get the underlying Java method.
      Returns:
      the underlying Java method.
    • getDeclaredMethod

      Method getDeclaredMethod()
      Get the underlying declared Java method. This method overrides or is the same as the one retrieved by getMethod.
      Returns:
      the underlying declared Java method.
    • getParameterAnnotations

      public Annotation[][] getParameterAnnotations()
      Get method parameter annotations.
      Returns:
      method parameter annotations.
    • getParameterTypes

      public Class<?>[] getParameterTypes()
      Get method parameter types. See also Method.getParameterTypes().
      Returns:
      method parameter types.
    • getTypeParameters

      public TypeVariable<Method>[] getTypeParameters()
      Get method type parameters. See also Method.getTypeParameters().
      Returns:
      method type parameters.
    • getGenericParameterTypes

      public Type[] getGenericParameterTypes()
      Get generic method parameter types. See also Method.getGenericParameterTypes().
      Returns:
      generic method parameter types.
    • getMetaMethodAnnotations

      public <T extends Annotation> List<T> getMetaMethodAnnotations(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 String toString()
      Overrides:
      toString in class Object
    • isAnnotationPresent

      public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
      Specified by:
      isAnnotationPresent in interface AnnotatedElement
    • getAnnotation

      public <T extends Annotation> T getAnnotation(Class<T> annotationType)
      Specified by:
      getAnnotation in interface AnnotatedElement
    • getAnnotations

      public Annotation[] getAnnotations()
      Specified by:
      getAnnotations in interface AnnotatedElement
    • getDeclaredAnnotations

      public Annotation[] getDeclaredAnnotations()
      Specified by:
      getDeclaredAnnotations in interface AnnotatedElement
    • mergeMethodAnnotations

      private static Annotation[] mergeMethodAnnotations(Method m, Method am)
    • mergeParameterAnnotations

      private static Annotation[][] mergeParameterAnnotations(Method m, Method am)
    • annotationNotInList

      private static boolean annotationNotInList(Class<? extends Annotation> ca, List<Annotation> la)
    • findAnnotatedMethod

      private static Method findAnnotatedMethod(Method m)
    • findAnnotatedMethod

      private static Method findAnnotatedMethod(Class<?> c, Method m)
    • hasAnnotations

      private static boolean hasAnnotations(Method m)
    • hasMetaMethodAnnotations

      private static boolean hasMetaMethodAnnotations(Method m)
    • hasMethodAnnotations

      private static boolean hasMethodAnnotations(Method m)
    • hasParameterAnnotations

      private static boolean hasParameterAnnotations(Method m)
    • asList

      @SafeVarargs private static <T> List<T> asList(T... ts)