java 将对象数据复制到另一个对象中
import org.apache.commons.beanutils.BeanUtils;
import java.lang.reflect.InvocationTargetException;
Car newItem = new Car();
Car newOld = new Car();
try {
BeanUtils.copyProperties(newItem, newOld );
} catch (IllegalAccessException | InvocationTargetException e) {
//
}
这样newItem 中就有newOld 相关的数据了
浙公网安备 33010602011771号