您的位置:首页 > 运维架构

BeanUtils.populate(obj,map)的作用

2016-12-27 11:36 429 查看
首先,它是 org.apache.commons.beanutils.BeanUtils包中的一个方法。
方法的作用:用来将一些 key-value 的值(例如 hashmap)映射到 bean 中的属性。
之后我们就可以这样使用xxxbean.getXxxx()来取值了。


for (Object obj : list) {
if (def != null && !def.isEmpty()) {
BeanUtils.populate(obj, def);//(调用包中方法映射)

}
sqlDao.create(tableAnnotation.namespace() + "." + tableAnnotation.createSql(), obj);
}



                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  hashmap bean 对象 populate