对象拷贝类PropertyUtils,BeanUtils,BeanCopier课稿.doc

对象拷贝类PropertyUtils,BeanUtils,BeanCopier课稿.doc

? ???对象拷贝类PropertyUtils,BeanUtils,BeanCopier 功能简介 业务系统中经常需要两个对象进行属性的拷贝,不能否认逐个的对象拷贝是最快速最安全的做法,但是当数据对象的属性字段数量超过程序员的容忍的程度,代码因此变得臃肿不堪,使用一些方便的对象拷贝工具类将是很好的选择。 Apache的两个版本:(反射机制) mons.beanutils.PropertyUtils.copyProperties(Object dest, Object orig) mons.beanutils.BeanUtils.copyProperties(Object dest, Object orig) spring版本:(反射机制) org.springframework.beans.BeanUtils.copyProperties(Object source, Object target, Class editable, String[] ignoreProperties) cglib版本:(使用动态代理,效率高) net.sf.cglib.beans.BeanCopier.copy(Object paramObject1, Object paramObject2, Converter paramConverter) ) 都使用静态类调用,最终转化虚拟机中两个单例的

文档评论(0)

1亿VIP精品文档

相关文档