public class AnnotationUtil extends Object
| Constructor and Description |
|---|
AnnotationUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Set<Annotation> |
getAllAnnotations(Class<?> cls)
递归Class所有的Annotation,一个最彻底的实现.
|
static <T extends Annotation> |
getAnnotatedFields(Class<? extends Object> clazz,
Class<T> annotation)
找出所有标注了该annotation的属性,循环遍历父类,包含private属性.
|
static <T extends Annotation> |
getAnnotatedPublicFields(Class<? extends Object> clazz,
Class<T> annotation)
找出所有标注了该annotation的公共属性,循环遍历父类.
|
static <T extends Annotation> |
getAnnotatedPublicMethods(Class<?> clazz,
Class<T> annotation)
找出所有标注了该annotation的公共方法(含父类的公共函数),循环其接口.
|
public static Set<Annotation> getAllAnnotations(Class<?> cls)
public static <T extends Annotation> Set<Field> getAnnotatedPublicFields(Class<? extends Object> clazz, Class<T> annotation)
public static <T extends Annotation> Set<Field> getAnnotatedFields(Class<? extends Object> clazz, Class<T> annotation)
public static <T extends Annotation> Set<Method> getAnnotatedPublicMethods(Class<?> clazz, Class<T> annotation)
Copyright © 2018. All rights reserved.