填坑-十万个为何?(25)

以前的笔记主要涉及前端,以后会以这个Web知识体系作学习html

1.Java中对象属性拷贝的方法和性能对比

①手动拷贝(set)
②动态代理
    cglib版本:'net.sf.cglib.beans.BeanCopier.copy(Object from, Object to, Converter converter)'
③反射机制
    Spring版本:'org.springframework.beans.BeanUtils.copyProperties(Object source, Object target) '
    Apache版本:'org.apache.commons.beanutils.PropertyUtils.copyProperties(Object dest, Object orig) '
                'org.apache.commons.beanutils.BeanUtils.copyProperties(Object dest, Object orig)'
④dozer版本(xml配置映射)
                'org.dozer.DozerBeanMapper.map(Object source, Class<T> destinationClass)'
复制代码

拷贝对象属性时间复杂度T(n)
manualCopy > cglibCopy > springBeanUtils > apachePropertyUtils > apacheBeanUtils前端

参考文章:
做者:三石雨 原文:对象属性拷贝工具类的性能比较java

相关文章
相关标签/搜索