JAVA复制对象和集合的工具类
因为BeanUtils.copyProperties(Object source, Object target),只能复制对象,不能复制数组和集合,所以决定写个工具类来解决
public class CopyUtils {
/**
* 复制对象
*/
public static <T,K> T convert(K source, Class<T> clazz) {
T t = BeanUtils.instantiate(clazz);
BeanUtils.copyProperties(source, t)