public class ReflectionUtils extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static Field |
findField(Class<?> targetClass,
String fieldName)
根据
fieldName在targetClass查找,支持父类的属性查找。 |
static Field |
findField(Class<?> targetClass,
String fieldName,
Class<?> fieldType)
根据
fieldName或fieldType在targetClass查找,支持父类的属性查找。 |
static List<Field> |
getDeclaredFields(Class<?> targetClass)
获取Class定义的属性列表
|
static List<Field> |
getDeclaredFields(Class<?> targetClass,
FieldFilter... fieldFilters)
根据过滤器过滤属性,最后返回类解析的属性列表
|
public static List<Field> getDeclaredFields(Class<?> targetClass)
targetClass - 目标类型public static List<Field> getDeclaredFields(Class<?> targetClass, FieldFilter... fieldFilters)
targetClass - 目标类型fieldFilters - 过滤器public static Field findField(Class<?> targetClass, String fieldName)
fieldName在targetClass查找,支持父类的属性查找。targetClass - the class to introspect.fieldName - the name of the field.null if not found.public static Field findField(Class<?> targetClass, String fieldName, Class<?> fieldType)
fieldName或fieldType在targetClass查找,支持父类的属性查找。targetClass - the class to introspect.fieldName - the name of the field.fieldType - the type of the field.null if not found.Copyright © 2017. All rights reserved.