将源对象的值赋值给新的对象属性值
BeanUtils方法
copyProperties(Object source, Object target, Class<?> editable)
参数1源对象(取值的对象) 参数2目标对象(给此对象赋值) 属性参照为editable类型中对应的属性
Copy the property values of the given source bean into the given target bean, only setting properties defined in the given "editable" class (or interface).
如:
Student sourceStu = new Student();
sourceStu.setName("张三");
sourceStu.setAge(15);
Student targetStu = new Student();
BeanUtils.copyProperties(sourceStu,targetStu,Student.class);
System.out.println(targetStu.getName());
输出为:张三