填坑-十萬個爲何?(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

相關文章
相關標籤/搜索