Package libcore.reflect
Class AnnotationAccess
- java.lang.Object
-
- libcore.reflect.AnnotationAccess
-
public final class AnnotationAccess extends Object
Look up annotations from a dex file.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <A extends Annotation>
AgetAnnotation(Class<?> c, Class<A> annotationType)static Annotation[]getAnnotations(Class<?> c)static <A extends Annotation>
AgetDeclaredAnnotation(AnnotatedElement element, Class<A> annotationClass)Returns the annotation if it exists.static List<Annotation>getDeclaredAnnotations(AnnotatedElement element)Returns the annotations onelement.static ObjectgetDefaultValue(Method method)static Class<?>getEnclosingClass(Class<?> c)Returns the class of whichcis a direct member.static AccessibleObjectgetEnclosingMethodOrConstructor(Class<?> c)static Class<?>[]getExceptions(AnnotatedElement element)static intgetInnerClassFlags(Class<?> c, int defaultValue)static StringgetInnerClassName(Class<?> c)static Class<?>[]getMemberClasses(Class<?> c)static Annotation[][]getParameterAnnotations(Class<?> declaringClass, int methodDexIndex)Returns the parameter annotations onmember.static StringgetSignature(AnnotatedElement element)static booleanisAnnotationPresent(Class<?> c, Class<? extends Annotation> annotationType)Returns true ifcis annotated byannotationType.static booleanisAnonymousClass(Class<?> c)static booleanisDeclaredAnnotationPresent(AnnotatedElement element, Class<? extends Annotation> annotationClass)Returns true if the annotation exists.
-
-
-
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 ifcis annotated byannotationType.
-
getDeclaredAnnotations
public static List<Annotation> getDeclaredAnnotations(AnnotatedElement element)
Returns the annotations onelement.
-
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 onmember.
-
getEnclosingClass
public static Class<?> getEnclosingClass(Class<?> c)
Returns the class of whichcis a direct member. Ifcis defined in a method or constructor, this is not transitive.
-
getEnclosingMethodOrConstructor
public static AccessibleObject getEnclosingMethodOrConstructor(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)
-
isAnonymousClass
public static boolean isAnonymousClass(Class<?> c)
-
-