首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

32 运用BeanUtils工具包操作JavaBean

2012-12-21 
32 使用BeanUtils工具包操作JavaBean?ReflectPoint pt1 new ReflectPoint(3,5)System.out.println(Bean

32 使用BeanUtils工具包操作JavaBean

?

ReflectPoint pt1 = new ReflectPoint(3,5); System.out.println(BeanUtils.getProperty(pt1, "x").getClass().getName()); BeanUtils.setProperty(pt1, "x", "9"); System.out.println(pt1.getX()); /* //java7的新特性 Map map = {name:"zxx",age:18}; BeanUtils.setProperty(map, "name", "lhm"); */ BeanUtils.setProperty(pt1, "birthday.time", "111");//支持属性的级联操作 System.out.println(BeanUtils.getProperty(pt1, "birthday.time")); PropertyUtils.setProperty(pt1, "x", 9); System.out.println(PropertyUtils.getProperty(pt1, "x").getClass().getName());?

? ? ? ? ? ? ?

?

热点排行