public interface ReflectUtil
| 限定符和类型 | 方法和说明 |
|---|---|
static <T extends Annotation> |
getAnnotation(Field field,
Class<T> annotation)
获得字段或字段get方法上的注解
|
static Method |
getFieldGetter(Class<?> clazz,
String fieldName)
获得字段的get方法
|
static Method |
getFieldSetter(Class<?> clazz,
String fieldName)
获得字段的set方法
|
static List<Field> |
getNonStaticFields(Class<?> clazz)
获得非静态字段列表
|
static List<Field> getNonStaticFields(Class<?> clazz)
clazz - classstatic Method getFieldGetter(Class<?> clazz, String fieldName)
clazz - 字段所属classfieldName - 字段名称Methodstatic Method getFieldSetter(Class<?> clazz, String fieldName)
clazz - 字段所属classfieldName - 字段名称Methodstatic <T extends Annotation> T getAnnotation(Field field, Class<T> annotation)
T - 注解类型field - 字段annotation - 注解TCopyright © 2021. All rights reserved.