包含功能:
- 对象深复制
import org.springframework.beans.BeanUtils;
/**
* @Description: Bean处理类
* @Author: thp-mac
* @Date: 2020/12/10
* @Version: 1.0
**/
public class MyBeanUtils<T> {
public static <T> T copy(T source) {
if (source == null) {
return source;
}
try {
T t2 = (T) source.getClass().newInstance();
BeanUtils.copyProperties(source, t2);
return t2;
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
return null;
}
}