对象的值赋给另一个对象
- 摘要:1,导入importorg.apache.commons.beanutils.BeanUtils;2新建Demodemo=newDemo();demo.setId(1);demo.setAddress("测试区");demo.setUsername("我是测试人员");Demo1demo1=newDemo1();2BeanUtils.copyProperties(demo1,demo);//demo1是接收者,后者是赋值者//对象转mapMapmap=BeanUtils.describe
- 标签:
1,导入import org.apache.commons.beanutils.BeanUtils;
2新建
Demo demo= new Demo();
demo.setId(1);
demo.setAddress("测试区");
demo.setUsername("我是测试人员");
Demo1 demo1= new Demo1();
2 BeanUtils.copyProperties(demo1, demo);//demo1是接收者,后者是赋值者
//对象转map
Map map=BeanUtils.describe(demo1);