Class AnnotationAccess


  • public final class AnnotationAccess
    extends Object
    Look up annotations from a dex file.
    • Method Detail

      • getAnnotation

        public static <A extends Annotation> A getAnnotation​(Class<?> c,
                                                             Class<A> annotationType)
      • getAnnotations

        public static Annotation[] getAnnotations​(Class<?> c)
      • isAnnotationPresent

        public static boolean isAnnotationPresent​(Class<?> c,
                                                  Class<? extends Annotation> annotationType)
        Returns true if c is annotated by annotationType.
      • getDeclaredAnnotation

        public static <A extends Annotation> A getDeclaredAnnotation​(AnnotatedElement element,
                                                                     Class<A> annotationClass)
        Returns the annotation if it exists.
      • isDeclaredAnnotationPresent

        public static boolean isDeclaredAnnotationPresent​(AnnotatedElement element,
                                                          Class<? extends Annotation> annotationClass)
        Returns true if the annotation exists.
      • getParameterAnnotations

        public static Annotation[][] getParameterAnnotations​(Class<?> declaringClass,
                                                             int methodDexIndex)
        Returns the parameter annotations on member.
      • getDefaultValue

        public static Object getDefaultValue​(Method method)
      • getEnclosingClass

        public static Class<?> getEnclosingClass​(Class<?> c)
        Returns the class of which c is a direct member. If c is defined in a method or constructor, this is not transitive.
      • getEnclosingMethodOrConstructor

        public static AccessibleObject getEnclosingMethodOrConstructor​(Class<?> c)
      • getMemberClasses

        public static Class<?>[] getMemberClasses​(Class<?> c)
      • getSignature

        public static String getSignature​(AnnotatedElement element)
        Parameters:
        element - a class, a field, a method or a constructor.
      • getExceptions

        public static Class<?>[] getExceptions​(AnnotatedElement element)
        Parameters:
        element - a method or a constructor.
      • getInnerClassFlags

        public static int getInnerClassFlags​(Class<?> c,
                                             int defaultValue)
      • getInnerClassName

        public static String getInnerClassName​(Class<?> c)
      • isAnonymousClass

        public static boolean isAnonymousClass​(Class<?> c)