类 BeanUtil
java.lang.Object
com.xiaoTools.util.beanUtil.BeanUtil
public class BeanUtil extends Object
[Bean工具类](Bean util)
- 从以下版本开始:
- 2021-10-25 08:56:53
- 版本:
- V1.0
- 作者:
- XiaoXunYao
-
构造器概要
构造器 构造器 说明 BeanUtil()
-
方法概要
修饰符和类型 方法 说明 static Map<String,Object>
beanToMap(Object bean)
[对象转Map](Object to map)static Map<String,Object>
beanToMap(Object bean, boolean isToUnderlineCase, boolean ignoreNullValue)
[对象转Map](Object to map)static Map<String,Object>
beanToMap(Object bean, Map<String,Object> targetMap, boolean isToUnderlineCase, boolean ignoreNullValue)
[对象转Map](Object to map)static Map<String,Object>
beanToMap(Object bean, Map<String,Object> targetMap, boolean ignoreNullValue, Editor<String> keyEditor)
[对象转Map](Object to map)static <T> T
copyProperties(Object source, Class<T> tClass, String... ignoreProperties)
[按照Bean对象属性创建对应的Class对象](Create the corresponding class object according to the bean object attribute)static void
copyProperties(Object source, Object target, boolean ignoreCase)
[复制Bean对象属性](Copy bean object properties)static void
copyProperties(Object source, Object target, CopyOptions copyOptions)
[复制Bean对象属性](Copy bean object properties)static void
copyProperties(Object source, Object target, String... ignoreProperties)
[复制Bean对象属性](Copy bean object properties)static DynaBean
createDynaBean(Object bean)
[创建动态Bean](Create dynamic bean)static void
descForEach(Class<?> clazz, Consumer<? super PropDesc> action)
[遍历Bean的属性](Traversing the properties of a bean)static <T> T
fillBean(T bean, ValueProvider<String> valueProvider, CopyOptions copyOptions)
[填充Bean的核心方法](Core method of filling bean)static <T> T
fillBeanWithMap(Map<?,?> map, T bean, boolean isIgnoreError)
[使用Map填充Bean对象](Filling bean objects with map)static <T> T
fillBeanWithMap(Map<?,?> map, T bean, boolean isToCamelCase, boolean isIgnoreError)
[使用Map填充Bean对象](Filling bean objects with map)static <T> T
fillBeanWithMap(Map<?,?> map, T bean, boolean isToCamelCase, CopyOptions copyOptions)
[使用Map填充Bean对象](Filling bean objects with map)static <T> T
fillBeanWithMap(Map<?,?> map, T bean, CopyOptions copyOptions)
[使用Map填充Bean对象](Filling bean objects with map)static <T> T
fillBeanWithMapIgnoreCase(Map<?,?> map, T bean, boolean isIgnoreError)
[使用Map填充Bean对象](Filling bean objects with map)static PropertyEditor
findEditor(Class<?> type)
[查找类型转换器](Find type converter)static BeanDesc
getBeanDesc(Class<?> clazz)
[获取 Bean 描述信息](Get bean description information)static Object
getFieldValue(Object bean, String fieldNameOrIndex)
[获得字段值](Get field value)static <T> T
getProperty(Object bean, String expression)
[解析Bean中的属性值](Resolve attribute values in a bean)static PropertyDescriptor
getPropertyDescriptor(Class<?> clazz, String fieldName)
[获得Bean类属性描述,大小写敏感](Get the bean class attribute description, case sensitive)static PropertyDescriptor
getPropertyDescriptor(Class<?> clazz, String fieldName, boolean ignoreCase)
[获得Bean类属性描述](Get the bean class attribute description)static Map<String,PropertyDescriptor>
getPropertyDescriptorMap(Class<?> clazz, boolean ignoreCase)
[获得字段名和字段描述Map](Get field name and field description map)static PropertyDescriptor[]
getPropertyDescriptors(Class<?> clazz)
[获得Bean字段描述数组](Get bean field description array)static boolean
hasGetter(Class<?> clazz)
[判断是否有Getter方法](Determine whether there is a getter method)static boolean
hasNullField(Object bean, String... ignoreFiledNames)
[判断Bean是否包含值为 null 的属性](Determine whether the bean contains a property with null value)static boolean
hasPublicField(Class<?> clazz)
[指定类中是否有public类型字段](Specifies whether there is a public type field in the class)static boolean
hasSetter(Class<?> clazz)
[判断是否有Setter方法](Judge whether there is setter method)static boolean
isBean(Class<?> clazz)
[判断是否为Bean对象](Determine whether it is a bean object)static boolean
isEmpty(Object bean, String... ignoreFiledNames)
[判断Bean是否为空对象](Determine whether the bean is an empty object)static boolean
isMatchName(Object bean, String beanClassName, boolean isSimple)
[给定的Bean的类名是否匹配指定类名字符串](Does the class name of the given bean match the specified class name string)static boolean
isNotEmpty(Object bean, String... ignoreFiledNames)
[判断Bean是否为非空对象](Determine whether the bean is a non empty object)static boolean
isReadableBean(Class<?> clazz)
[判断是否为可读的Bean对象](Determine whether it is a readable bean object)static <T> T
mapToBean(Map<?,?> map, Class<T> beanClass, boolean isToCamelCase, CopyOptions copyOptions)
[Map转换为Bean对象](Convert map to bean object)static void
setFieldValue(Object bean, String fieldNameOrIndex, Object value)
[获得字段值](Get field value)static void
setProperty(Object bean, String expression, Object value)
[解析Bean中的属性值](Resolve attribute values in a bean)static <T> T
toBean(Class<T> beanClass, ValueProvider<String> valueProvider, CopyOptions copyOptions)
[ServletRequest 参数转 Bean](ServletRequest parameter to bean)static <T> T
toBean(Object source, Class<T> clazz)
[对象或Map转Bean](Object or map to bean)static <T> T
toBean(Object source, Class<T> clazz, CopyOptions options)
[对象或Map转Bean](Object or map to bean)static <T> T
toBeanIgnoreCase(Object source, Class<T> clazz, boolean ignoreError)
[对象或Map转Bean](Object or map to bean)static <T> T
toBeanIgnoreError(Object source, Class<T> clazz)
[对象或Map转Bean](Object or map to bean)static <T> T
trimStrFields(T bean, String... ignoreFields)
[把Bean里面的String属性做trim操作](Trim the string attribute in the bean)
-
构造器详细资料
-
BeanUtil
public BeanUtil()
-
-
方法详细资料
-
isReadableBean
[判断是否为可读的Bean对象](Determine whether it is a readable bean object)- 参数:
clazz
- 待测试类- 返回:
- boolean
- 从以下版本开始:
- 2021-10-25 08:59:41
-
hasSetter
[判断是否有Setter方法](Judge whether there is setter method)- 参数:
clazz
- 类型- 返回:
- boolean
- 从以下版本开始:
- 2021-10-25 09:01:59
-
hasGetter
[判断是否有Getter方法](Determine whether there is a getter method)- 参数:
clazz
- 类型- 返回:
- boolean
- 从以下版本开始:
- 2021-10-25 09:04:35
-
isBean
[判断是否为Bean对象](Determine whether it is a bean object)- 参数:
clazz
- 实体类- 返回:
- boolean
- 从以下版本开始:
- 2021-10-28 09:58:20
-
getProperty
[解析Bean中的属性值](Resolve attribute values in a bean)- 参数:
bean
- Bean对象expression
- 表达式- 返回:
- T
- 从以下版本开始:
- 2021-10-28 10:00:21
-
hasPublicField
[指定类中是否有public类型字段](Specifies whether there is a public type field in the class)- 参数:
clazz
- 类型- 返回:
- boolean
- 从以下版本开始:
- 2021-10-25 09:13:11
-
createDynaBean
[创建动态Bean](Create dynamic bean)- 参数:
bean
- 实体类- 从以下版本开始:
- 2021-10-25 18:13:10
-
findEditor
[查找类型转换器](Find type converter)- 参数:
type
- 类型- 返回:
- java.beans.PropertyEditor
- 从以下版本开始:
- 2021-10-25 19:29:30
-
getBeanDesc
[获取 Bean 描述信息](Get bean description information)- 参数:
class
- Bean类- 从以下版本开始:
- 2021-10-26 09:12:35
-
descForEach
[遍历Bean的属性](Traversing the properties of a bean)- 参数:
clazz
- Bean类action
- 每个元素的处理类- 从以下版本开始:
- 2021-10-26 09:13:59
-
getPropertyDescriptors
[获得Bean字段描述数组](Get bean field description array)- 参数:
clazz
- Bean类- 返回:
- java.beans.PropertyDescriptor[]
- 抛出:
BeanException
- 从以下版本开始:
- 2021-10-26 09:41:22
-
getPropertyDescriptorMap
public static Map<String,PropertyDescriptor> getPropertyDescriptorMap(Class<?> clazz, boolean ignoreCase) throws BeanException[获得字段名和字段描述Map](Get field name and field description map)- 参数:
clazz
-ignoreCase
-- 返回:
- java.util.Map
- 抛出:
BeanException
- 从以下版本开始:
- 2021-10-26 09:58:46
-
getPropertyDescriptor
public static PropertyDescriptor getPropertyDescriptor(Class<?> clazz, String fieldName) throws BeanException[获得Bean类属性描述,大小写敏感](Get the bean class attribute description, case sensitive)- 参数:
clazz
- 实体类fieldName
- 字段名称- 返回:
- java.beans.PropertyDescriptor
- 抛出:
BeanException
- 从以下版本开始:
- 2021-10-26 20:15:27
-
getPropertyDescriptor
public static PropertyDescriptor getPropertyDescriptor(Class<?> clazz, String fieldName, boolean ignoreCase) throws BeanException[获得Bean类属性描述](Get the bean class attribute description)- 参数:
clazz
- bean实体类- 返回:
- fieldName 字段名称
- 抛出:
BeanException
- 从以下版本开始:
- 2021-10-26 20:16:19
-
getFieldValue
[获得字段值](Get field value)- 参数:
bean
-fieldNameOrIndex
-- 返回:
- java.lang.Object
- 从以下版本开始:
- 2021-10-26 20:18:41
-
setFieldValue
[获得字段值](Get field value)- 参数:
bean
- BeanfieldNameOrIndex
- 字段名或序号value
- 值- 从以下版本开始:
- 2021-10-26 20:20:38
-
setProperty
[解析Bean中的属性值](Resolve attribute values in a bean)- 参数:
bean
- 实体类expression
- 表达式value
- 属性值- 从以下版本开始:
- 2021-10-26 20:23:44
-
mapToBean
public static <T> T mapToBean(Map<?,?> map, Class<T> beanClass, boolean isToCamelCase, CopyOptions copyOptions)[Map转换为Bean对象](Convert map to bean object)- 参数:
map
- MapbeanClass
- 实体类isToCamelCase
- 是否将Map中的下划线风格key转换为驼峰风格copyOptions
- 转Bean选项- 返回:
- T
- 从以下版本开始:
- 2021-10-27 08:51:25
-
fillBeanWithMap
[使用Map填充Bean对象](Filling bean objects with map)- 参数:
map
- Mapbean
- BeanisIgnoreError
- 是否忽略注入错误- 返回:
- T
- 从以下版本开始:
- 2021-10-27 09:42:44
-
fillBeanWithMap
public static <T> T fillBeanWithMap(Map<?,?> map, T bean, boolean isToCamelCase, boolean isIgnoreError)[使用Map填充Bean对象](Filling bean objects with map)- 参数:
map
- Mapbean
- BeanisToCamelCase
- 是否将下划线模式转换为驼峰模式isIgnoreError
- 是否忽略注入错误- 返回:
- T
- 从以下版本开始:
- 2021-10-27 09:44:44
-
fillBeanWithMapIgnoreCase
[使用Map填充Bean对象](Filling bean objects with map)- 参数:
map
- Mapbean
- BeanisIgnoreError
- 是否忽略注入错误- 返回:
- T
- 从以下版本开始:
- 2021-10-27 09:47:10
-
fillBeanWithMap
[使用Map填充Bean对象](Filling bean objects with map)- 参数:
map
- Mapbean
- BeancopyOptions
- 转Bean选项- 返回:
- T
- 从以下版本开始:
- 2021-10-27 09:47:32
-
fillBeanWithMap
public static <T> T fillBeanWithMap(Map<?,?> map, T bean, boolean isToCamelCase, CopyOptions copyOptions)[使用Map填充Bean对象](Filling bean objects with map)- 参数:
map
- Mapbean
- BeanisToCamelCase
- 是否将下划线模式转换为驼峰模式copyOptions
- 转Bean选项- 从以下版本开始:
- 2021-10-27 09:48:42
-
toBean
[对象或Map转Bean](Object or map to bean)- 参数:
source
- Bean对象或Mapclazz
- 目标的Bean类型- 返回:
- T
- 从以下版本开始:
- 2021-10-27 17:58:46
-
toBeanIgnoreError
[对象或Map转Bean](Object or map to bean)- 参数:
source
- Bean对象或Mapclazz
- 目标的Bean类型- 返回:
- T
- 从以下版本开始:
- 2021-10-27 17:59:49
-
toBeanIgnoreCase
[对象或Map转Bean](Object or map to bean)- 参数:
source
- Bean对象或Mapclazz
- 目标的Bean类型ignoreError
- 是否忽略注入错误- 返回:
- T
- 从以下版本开始:
- 2021-10-27 18:01:55
-
toBean
[对象或Map转Bean](Object or map to bean)- 参数:
source
- Bean对象或Mapclazz
- 目标的Bean类型options
- 属性拷贝选项- 返回:
- T
- 从以下版本开始:
- 2021-10-27 18:02:49
-
toBean
public static <T> T toBean(Class<T> beanClass, ValueProvider<String> valueProvider, CopyOptions copyOptions)[ServletRequest 参数转 Bean](ServletRequest parameter to bean)- 参数:
beanClass
- Bean ClassvalueProvider
- 值提供者copyOptions
- 拷贝选项- 返回:
- T
- 从以下版本开始:
- 2021-10-27 18:03:55
-
fillBean
[填充Bean的核心方法](Core method of filling bean)- 参数:
bean
- Bean ClassvalueProvider
- 值提供者copyOptions
- 拷贝选项- 返回:
- T
- 从以下版本开始:
- 2021-10-27 18:05:25
-
beanToMap
[对象转Map](Object to map)- 参数:
bean
- 实体类- 返回:
- java.util.Map
- 从以下版本开始:
- 2021-10-28 09:09:17
-
beanToMap
public static Map<String,Object> beanToMap(Object bean, boolean isToUnderlineCase, boolean ignoreNullValue)[对象转Map](Object to map)- 参数:
bean
- 实体类isToUnderlineCase
- 是否转换为下划线模式ignoreNullValue
- 是否忽略值为空的字段- 返回:
- java.util.Map
- 从以下版本开始:
- 2021-10-28 09:10:47
-
beanToMap
public static Map<String,Object> beanToMap(Object bean, Map<String,Object> targetMap, boolean isToUnderlineCase, boolean ignoreNullValue)[对象转Map](Object to map)- 参数:
bean
- 实体类targetMap
- 目标的MapisToUnderlineCase
- 是否转换为下划线模式ignoreNullValue
- 是否忽略值为空的字段- 返回:
- java.util.Map
- 从以下版本开始:
- 2021-10-28 09:12:17
-
beanToMap
public static Map<String,Object> beanToMap(Object bean, Map<String,Object> targetMap, boolean ignoreNullValue, Editor<String> keyEditor)[对象转Map](Object to map)- 参数:
bean
- 实体类targetMap
- 目标的MapignoreNullValue
- 是否忽略值为空的字段keyEditor
- 属性字段(Map的key)编辑器- 返回:
- java.util.Map
- 从以下版本开始:
- 2021-10-28 09:14:20
-
copyProperties
[按照Bean对象属性创建对应的Class对象](Create the corresponding class object according to the bean object attribute)- 参数:
source
- 源Bean对象tClass
- 目标ClassignoreProperties
- 不拷贝的的属性列表- 返回:
- T
- 从以下版本开始:
- 2021-10-28 09:16:47
-
copyProperties
[复制Bean对象属性](Copy bean object properties)- 参数:
source
- 源Bean对象target
- 目标Bean对象ignoreProperties
- 不拷贝的的属性列表- 从以下版本开始:
- 2021-10-28 09:17:51
-
copyProperties
[复制Bean对象属性](Copy bean object properties)- 参数:
source
- 源Bean对象target
- 目标Bean对象ignoreCase
- 是否忽略大小写- 从以下版本开始:
- 2021-10-28 09:19:18
-
copyProperties
[复制Bean对象属性](Copy bean object properties)- 参数:
source
- 源Bean对象target
- 目标Bean对象copyOptions
- 拷贝选项- 从以下版本开始:
- 2021-10-28 09:20:01
-
isMatchName
[给定的Bean的类名是否匹配指定类名字符串](Does the class name of the given bean match the specified class name string)- 参数:
bean
- BeanbeanClassName
- Bean的类名isSimple
- 是否只匹配类名而忽略包名,true表示忽略包名- 返回:
- boolean
- 从以下版本开始:
- 2021-10-28 09:20:48
-
trimStrFields
[把Bean里面的String属性做trim操作](Trim the string attribute in the bean)- 参数:
bean
- 实体类ignoreFields
- 不需要trim的Field名称列表(不区分大小写)- 返回:
- T
- 从以下版本开始:
- 2021-10-28 09:22:23
-
isNotEmpty
[判断Bean是否为非空对象](Determine whether the bean is a non empty object)- 参数:
bean
- 实体类ignoreFiledNames
- 忽略检查的字段名- 返回:
- boolean
- 从以下版本开始:
- 2021-10-28 09:23:25
-
isEmpty
[判断Bean是否为空对象](Determine whether the bean is an empty object)- 参数:
bean
- 实体类ignoreFiledNames
- 忽略检查的字段名- 返回:
- boolean
- 从以下版本开始:
- 2021-10-28 09:24:38
-
hasNullField
[判断Bean是否包含值为 null 的属性](Determine whether the bean contains a property with null value)- 参数:
bean
- 实体类ignoreFiledNames
- 忽略检查的字段名- 返回:
- boolean
- 从以下版本开始:
- 2021-10-28 09:25:39
-