用法
依赖引入
Maven
<dependency>
<groupId>com.taocares.commons</groupId>
<artifactId>commons-beans</artifactId>
</dependency>基本用法
将源对象拷贝到已有的目标对象:
BeanUtils.copyProperties(sourceObject, targetObject);拷贝源对象并生成新的目标对象:
TargetObject targetObject = BeanUtils.copyProperties(sourceObject, TargetObject.class);拷贝源对象集合并生成目标对象集合:
List<TargetObject> targetObjects = BeanUtils.copyProperties(sourceObjects, TargetObject.class);
Set<TargetObject> targetObjects = BeanUtils.copyProperties(sourceObjects, TargetObject.class);映射配置
Last updated