public final class ReflectAnnotationUtil extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static Optional<Annotation> |
getAnnotation(Annotation annotation,
Class<? extends Annotation> annotationClass)
获取当前字段被指定注解标注的注解
|
static Optional<Annotation> |
getAnnotation(Class clazz,
Class<? extends Annotation> annotationClass)
获取类指定的注解
|
static Map<String,Object> |
getAnnotationAttributes(Annotation annotation)
获取对应的注解属性 map
https://segmentfault.com/a/1190000011213222?
|
static List<Annotation> |
getAnnotationRefs(Class clazz,
Class<? extends Annotation> annotationClass)
获取类对应的注解
(1)直接对应的注解
(2)被指定注解类型标注的注解。
|
static Object |
getValue(Annotation annotation,
String method)
获取值信息
|
static String |
getValueStr(Annotation annotation,
String method)
获取值信息-字符串形式
|
static void |
updateValue(Annotation annotation,
String method,
Object value)
更新值信息
|
public static void updateValue(Annotation annotation, String method, Object value)
annotation - 注解method - 方法value - 属性值public static Object getValue(Annotation annotation, String method)
annotation - 注解method - 方法public static String getValueStr(Annotation annotation, String method)
annotation - 注解method - 方法public static Map<String,Object> getAnnotationAttributes(Annotation annotation)
annotation - 直接public static Optional<Annotation> getAnnotation(Annotation annotation, Class<? extends Annotation> annotationClass)
annotation - 注解annotationClass - 标注注解类型public static Optional<Annotation> getAnnotation(Class clazz, Class<? extends Annotation> annotationClass)
clazz - 类annotationClass - 指定注解类型public static List<Annotation> getAnnotationRefs(Class clazz, Class<? extends Annotation> annotationClass)
clazz - 类型annotationClass - 注解类Copyright © 2024. All rights reserved.