@Component public class ReflectUtil extends Object
| 构造器和说明 |
|---|
ReflectUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
<S> org.springframework.data.jpa.domain.Specification<S> |
createOneSpecification(String attr,
String condition)
指定条件查询
|
<S> org.springframework.data.jpa.domain.Specification<S> |
createSpecification(Map<String,String> tableMap,
Class clazz,
List<String> excludeAttr)
生成全属性条件查询通用Specification
|
<S> org.springframework.data.jpa.domain.Specification<S> |
createSpecification(Map<String,String> tableMap,
Class clazz,
List<String> excludeAttr,
Map map)
已过时。
|
Object |
executeMethod(Object object,
String methodName,
Object... parameters)
通过方法名动态执行某个方法
|
Map<String,Class<?>> |
getFields(Object object)
获取对象所有属性及对应的类别
|
Map<String,Object> |
getFieldsValue(Object object)
获取所有属性值
|
<S> javax.persistence.criteria.Path |
getRootPath(javax.persistence.criteria.Root<S> root,
javax.persistence.criteria.Path path,
String allPath)
获取关联查询真实path
|
List<Field> |
getTargetAnnoation(Class<?> objectClass,
Class<? extends Annotation> annoClass)
获取拥有指定注解的字段
|
Map<String,Object> |
getValues(Object object)
获取所有属性值
|
Boolean |
setValue(Object object,
String property,
Object value)
设置属性值
|
@Deprecated public <S> org.springframework.data.jpa.domain.Specification<S> createSpecification(Map<String,String> tableMap, Class clazz, List<String> excludeAttr, Map map)
S - 泛型tableMap - 属性参数clazz - 要查询的实体类或vo类excludeAttr - 不使用模糊搜索的字符串属性map - 外键关联查询public <S> org.springframework.data.jpa.domain.Specification<S> createSpecification(Map<String,String> tableMap, Class clazz, List<String> excludeAttr)
S - 泛型tableMap - 属性参数clazz - 要查询的实体类或vo类excludeAttr - 不使用模糊搜索的字符串属性public <S> org.springframework.data.jpa.domain.Specification<S> createOneSpecification(String attr, String condition)
S - 泛型attr - 查询的字段condition - 条件public <S> javax.persistence.criteria.Path getRootPath(javax.persistence.criteria.Root<S> root,
javax.persistence.criteria.Path path,
String allPath)
S - Sroot - rootpath - pathallPath - allPathpublic Object executeMethod(Object object, String methodName, Object... parameters) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException
object - objectmethodName - 方法名parameters - 参数InvocationTargetException - InvocationTargetExceptionIllegalAccessException - IllegalAccessExceptionNoSuchMethodException - NoSuchMethodExceptionpublic Map<String,Object> getFieldsValue(Object object) throws IllegalAccessException
object - objectIllegalAccessException - IllegalAccessExceptionpublic Boolean setValue(Object object, String property, Object value)
property - 设置的字段value - 值object - objectpublic Map<String,Class<?>> getFields(Object object) throws IllegalAccessException
object - objectIllegalAccessException - IllegalAccessExceptionpublic Map<String,Object> getValues(Object object) throws IllegalAccessException
object - objectIllegalAccessException - IllegalAccessExceptionpublic List<Field> getTargetAnnoation(Class<?> objectClass, Class<? extends Annotation> annoClass)
objectClass - 对象annoClass - 查询的注解Copyright © 2021. All Rights Reserved.