public class Annotations extends Object
Modifier and Type | Method and Description |
---|---|
static <A extends Annotation> |
cast(Annotation a)
Annotation -> @
|
static <C,T extends Annotation> |
getAnnotatedConstructor(Class<C> targetClass,
Class<T> annotatedClass)
获取注释的 Constructor
|
static <T extends Annotation> |
getAnnotatedFields(Class<?> targetClass,
Class<T> annotatedClass)
获取注解字段
|
static <T extends Annotation> |
getAnnotatedFields(Class<?> targetClass,
Class<T> annotatedClass,
boolean byCache)
获取注解字段
|
static <T extends Annotation> |
getAnnotatedGetterMethods(Class<?> targetClass,
Class<T> annotatedClass)
获取注解 getter 方法
|
static <T extends Annotation> |
getAnnotatedGetterMethods(Class<?> targetClass,
Class<T> annotatedClass,
boolean byCache)
获取注解 getter 方法
|
static <T extends Annotation> |
getAnnotatedGetterMethodsMergeField(Class<?> targetClass,
Class<T> annotatedClass)
获取注解 getter 方法 合并 field
|
static <T extends Annotation> |
getAnnotatedGetterMethodsMergeField(Class<?> targetClass,
Class<T> annotatedClass,
boolean byCache)
获取注解 getter 方法 合并 field
|
static <T extends Annotation> |
getAnnotatedMethods(List<Method> methods,
Class<T> annotatedClass)
获取注解方法
|
static <T extends Annotation> |
getAnnotatedSetterMethods(Class<?> targetClass,
Class<T> annotatedClass)
获取注解 setter 方法
|
static <T extends Annotation> |
getAnnotatedSetterMethods(Class<?> targetClass,
Class<T> annotatedClass,
boolean byCache)
获取注解 setter 方法
|
static <T extends Annotation> |
getAnnotatedSetterMethodsMergeField(Class<?> targetClass,
Class<T> annotatedClass)
获取注解 setter 方法 合并 field
|
static <T extends Annotation> |
getAnnotatedSetterMethodsMergeField(Class<?> targetClass,
Class<T> annotatedClass,
boolean byCache)
获取注解 setter 方法 合并 field
|
static <A extends Annotation> |
getAnnotation(Class<?> clazz,
Class<A> annotation)
通过类型 获取 class 上的注解
|
static <A extends Annotation> |
getAnnotation(Constructor<?> constructor,
Class<A> annotation)
通过类型 获取 constructor 上的注解
|
static <A extends Annotation> |
getAnnotation(Field field,
Class<A> annotation)
通过类型 获取 field 上的注解
|
static <A extends Annotation> |
getAnnotation(Method method,
Class<A> annotation)
通过类型 获取 method 上的注解
|
static List<Annotation> |
getAnnotations(Class<?> clazz)
获取 class 上的注解
|
static <A extends Annotation> |
getAnnotations(Class<?> clazz,
Class<A> annotation)
通过类型 获取 class 上的所有注解
|
static <A extends Annotation> |
getAnnotations(Class<?> clazz,
Class<A> annotation,
int index)
通过类型 获取 class 上的注解
|
static <A extends Annotation> |
getAnnotations(Class<?> clazz,
int index)
获取 class 上的注解
|
static List<Annotation> |
getAnnotations(Constructor<?> constructor)
获取 constructor 上的注解
|
static <A extends Annotation> |
getAnnotations(Constructor<?> constructor,
int index)
获取 constructor 上的注解
|
static List<Annotation> |
getAnnotations(Field field)
获取 field 上的注解
|
static <A extends Annotation> |
getAnnotations(Field field,
int index)
获取 field 上的注解
|
static List<Annotation> |
getAnnotations(Method method)
获取 method 上的注解
|
static <A extends Annotation> |
getAnnotations(Method method,
int index)
获取 method 上的注解
|
static <A extends Annotation,E> |
getAttribute(A annotated,
String attributeName)
获取注解对应的属性值
|
static <A extends Annotation> |
getAttributes(A annotated)
获取注解所有的属性
|
static <A extends Annotation,E> |
getDefaultValue(A annotated)
获取注解 value 的默认值
|
static <A extends Annotation,E> |
getDefaultValue(A annotated,
String attributeName)
获取注解属性的默认值
|
static <E> E |
getDefaultValue(Class<? extends Annotation> annotatedClass)
获取注解 value 的默认值
|
static <E> E |
getDefaultValue(Class<? extends Annotation> annotatedClass,
String attributeName)
获取注解属性的默认值
|
static List<List<Annotation>> |
getParameterAnnotation(Constructor<?> constructor)
获取 constructor 参数上的注解
|
static List<Annotation> |
getParameterAnnotation(Constructor<?> constructor,
int paramIndex)
获取 constructor 参数上的注解
|
static <A extends Annotation> |
getParameterAnnotation(Constructor<?> constructor,
int paramIndex,
Class<A> annotation)
获取 constructor 参数上的注解
|
static <A extends Annotation> |
getParameterAnnotation(Constructor<?> constructor,
int paramIndex,
int index)
获取 constructor 参数上的注解
|
static List<List<Annotation>> |
getParameterAnnotation(Method method)
获取 method 参数上的注解
|
static List<Annotation> |
getParameterAnnotation(Method method,
int paramIndex)
获取 method 参数上的注解
|
static <A extends Annotation> |
getParameterAnnotation(Method method,
int paramIndex,
Class<A> annotation)
获取 method 参数上的注解
|
static <A extends Annotation> |
getParameterAnnotation(Method method,
int paramIndex,
int index)
获取 method 参数上的注解
|
static <A extends Annotation,E> |
getValue(A annotated)
获取注解对应的 value
|
static boolean |
present(Class<?> clazz,
Class<? extends Annotation>... annotatedClasses)
判断类是否有所有指定注解
|
static boolean |
present(Constructor<?> constructor,
Class<? extends Annotation>... annotatedClasses)
判断构造方法是否有所有指定注解
|
static boolean |
present(Field field,
Class<? extends Annotation>... annotatedClasses)
判断字段是否有所有指定注解
|
static boolean |
present(Method method,
Class<? extends Annotation>... annotatedClasses)
判断方法是否有所有指定注解
|
public static <A extends Annotation> A getAnnotation(Class<?> clazz, Class<A> annotation)
A
- Aclazz
- classannotation
- 注解classpublic static <A extends Annotation> List<A> getAnnotations(Class<?> clazz, Class<A> annotation)
A
- Aclazz
- classannotation
- 注解classRepeatable
public static <A extends Annotation> A getAnnotations(Class<?> clazz, Class<A> annotation, int index)
A
- Aclazz
- classannotation
- 注解classindex
- 注解索引Repeatable
public static List<Annotation> getAnnotations(Class<?> clazz)
clazz
- classpublic static <A extends Annotation> A getAnnotations(Class<?> clazz, int index)
A
- Aclazz
- classindex
- 注解索引public static <A extends Annotation> A getAnnotation(Constructor<?> constructor, Class<A> annotation)
A
- Aconstructor
- constructorannotation
- 注解classpublic static List<Annotation> getAnnotations(Constructor<?> constructor)
constructor
- constructorpublic static <A extends Annotation> A getAnnotations(Constructor<?> constructor, int index)
A
- Aconstructor
- constructorindex
- 注解索引public static <A extends Annotation> A getAnnotation(Field field, Class<A> annotation)
A
- Afield
- fieldannotation
- 注解classpublic static List<Annotation> getAnnotations(Field field)
field
- fieldpublic static <A extends Annotation> A getAnnotations(Field field, int index)
A
- Afield
- fieldindex
- 注解索引public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotation)
A
- Amethod
- methodannotation
- 注解classpublic static List<Annotation> getAnnotations(Method method)
method
- methodpublic static <A extends Annotation> A getAnnotations(Method method, int index)
A
- Amethod
- methodindex
- 注解索引public static <A extends Annotation> A getParameterAnnotation(Constructor<?> constructor, int paramIndex, Class<A> annotation)
A
- Aconstructor
- constructorparamIndex
- 参数索引annotation
- 注解classpublic static <A extends Annotation> A getParameterAnnotation(Constructor<?> constructor, int paramIndex, int index)
A
- Aconstructor
- constructorparamIndex
- 参数索引index
- 注解索引public static List<Annotation> getParameterAnnotation(Constructor<?> constructor, int paramIndex)
constructor
- constructorparamIndex
- 参数索引public static List<List<Annotation>> getParameterAnnotation(Constructor<?> constructor)
constructor
- constructorpublic static <A extends Annotation> A getParameterAnnotation(Method method, int paramIndex, Class<A> annotation)
A
- Amethod
- methodparamIndex
- 参数索引annotation
- 注解classpublic static <A extends Annotation> A getParameterAnnotation(Method method, int paramIndex, int index)
A
- Amethod
- methodparamIndex
- 参数索引index
- 注解索引public static List<Annotation> getParameterAnnotation(Method method, int paramIndex)
method
- methodparamIndex
- 参数索引public static List<List<Annotation>> getParameterAnnotation(Method method)
method
- method@SafeVarargs public static boolean present(Class<?> clazz, Class<? extends Annotation>... annotatedClasses)
clazz
- classannotatedClasses
- 注解类@SafeVarargs public static boolean present(Constructor<?> constructor, Class<? extends Annotation>... annotatedClasses)
constructor
- 构造方法annotatedClasses
- 注解类@SafeVarargs public static boolean present(Method method, Class<? extends Annotation>... annotatedClasses)
method
- 方法annotatedClasses
- 注解类@SafeVarargs public static boolean present(Field field, Class<? extends Annotation>... annotatedClasses)
field
- 字段annotatedClasses
- 注解类public static <A extends Annotation> A cast(Annotation a)
A
- Aa
- Annotationpublic static <A extends Annotation,E> E getValue(A annotated)
A
- AE
- Eannotated
- 注解public static <A extends Annotation,E> E getAttribute(A annotated, String attributeName)
A
- AE
- Eannotated
- 注解attributeName
- 属性名public static <A extends Annotation> MutableHashMap<String,Object> getAttributes(A annotated)
A
- Aannotated
- 注解public static <A extends Annotation,E> E getDefaultValue(A annotated)
A
- AE
- Eannotated
- 注解public static <A extends Annotation,E> E getDefaultValue(A annotated, String attributeName)
A
- AE
- Eannotated
- 注解attributeName
- 属性名public static <E> E getDefaultValue(Class<? extends Annotation> annotatedClass)
E
- EannotatedClass
- 注解类public static <E> E getDefaultValue(Class<? extends Annotation> annotatedClass, String attributeName)
E
- EannotatedClass
- 注解类attributeName
- 属性名public static <C,T extends Annotation> Map<Constructor<C>,T> getAnnotatedConstructor(Class<C> targetClass, Class<T> annotatedClass)
C
- classT
- TtargetClass
- targetClassannotatedClass
- annotatedClasspublic static <T extends Annotation> Map<Field,T> getAnnotatedFields(Class<?> targetClass, Class<T> annotatedClass)
T
- TtargetClass
- targetClassannotatedClass
- annotatedClasspublic static <T extends Annotation> Map<Field,T> getAnnotatedFields(Class<?> targetClass, Class<T> annotatedClass, boolean byCache)
T
- TtargetClass
- targetClassannotatedClass
- annotatedClassbyCache
- 是否使用缓存public static <T extends Annotation> Map<Method,T> getAnnotatedGetterMethods(Class<?> targetClass, Class<T> annotatedClass)
T
- TtargetClass
- targetClassannotatedClass
- annotatedClasspublic static <T extends Annotation> Map<Method,T> getAnnotatedGetterMethods(Class<?> targetClass, Class<T> annotatedClass, boolean byCache)
T
- TtargetClass
- targetClassannotatedClass
- annotatedClassbyCache
- 是否使用缓存public static <T extends Annotation> Map<Method,T> getAnnotatedSetterMethods(Class<?> targetClass, Class<T> annotatedClass)
T
- TtargetClass
- targetClassannotatedClass
- annotatedClasspublic static <T extends Annotation> Map<Method,T> getAnnotatedSetterMethods(Class<?> targetClass, Class<T> annotatedClass, boolean byCache)
T
- TtargetClass
- targetClassannotatedClass
- annotatedClassbyCache
- 是否使用缓存public static <T extends Annotation> Map<Method,T> getAnnotatedMethods(List<Method> methods, Class<T> annotatedClass)
T
- Tmethods
- methodsannotatedClass
- annotatedClasspublic static <T extends Annotation> Map<Method,T> getAnnotatedGetterMethodsMergeField(Class<?> targetClass, Class<T> annotatedClass)
T
- TtargetClass
- targetClassannotatedClass
- annotatedClasspublic static <T extends Annotation> Map<Method,T> getAnnotatedGetterMethodsMergeField(Class<?> targetClass, Class<T> annotatedClass, boolean byCache)
T
- TtargetClass
- targetClassannotatedClass
- annotatedClassbyCache
- 是否使用缓存public static <T extends Annotation> Map<Method,T> getAnnotatedSetterMethodsMergeField(Class<?> targetClass, Class<T> annotatedClass)
T
- TtargetClass
- targetClassannotatedClass
- annotatedClasspublic static <T extends Annotation> Map<Method,T> getAnnotatedSetterMethodsMergeField(Class<?> targetClass, Class<T> annotatedClass, boolean byCache)
T
- TtargetClass
- targetClassannotatedClass
- annotatedClassbyCache
- 是否使用缓存Copyright © 2024. All rights reserved.