public class ClassTypeUtil extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> Set<Class<?>> |
getAllClass(T entity)
获取类中所有的字段,如果是自定义类型或者Map、Bson类型,也将子字段获取
|
static List<Class<?>> |
getAllCustomFieldClasses(Class<?> clazz)
获取对象的所有自定义类字段类型
|
static List<Class<?>> |
getAllFieldClasses(Class<?> clazz)
获取对象的所有字段类型
|
static <T> Class<?> |
getClass(T entity) |
static Class<?> |
getClassByFieldType(Field field)
获取field的类型
|
static <T> Object |
getClassFieldValue(T entity,
String field) |
static List<Field> |
getFields(Class<?> clazz)
获取类的所有字段,包括父类中的字段
|
static <T> String |
getIdByEntity(T entity,
boolean exception)
获取实体类中,ID注解的值的值
|
static ClassTypeUtil |
getInstance() |
static Class<?> |
getListClass(List<?> list) |
static Class<?> |
getListGenericType(Field field)
获取List的泛型
|
static Boolean |
isItCustomType(Field field)
判断字段是否是自定义类型
|
public static ClassTypeUtil getInstance()
public static List<Class<?>> getAllFieldClasses(Class<?> clazz)
clazz - 待获取类型字段的classpublic static Boolean isItCustomType(Field field)
field - 字段public static List<Class<?>> getAllCustomFieldClasses(Class<?> clazz)
clazz - 待获取类型字段的classpublic static <T> String getIdByEntity(T entity, boolean exception)
public static <T> Set<Class<?>> getAllClass(T entity)
public static <T> Class<?> getClass(T entity)
Copyright © 2023. All rights reserved.