java bean 轉換工具

來源:互聯網
上載者:User

標籤:

考量要素: 
1.簡單的約定優於配置的同名屬性copy 
2.嵌套屬性copy 
3.flattern(扁平化)支援,要支援N層結構的copy到一層結構。 
4.效能 

如下這個網頁,裡面提到了好多工具。 
http://stackoverflow.com/questions/1432764/any-tool-for-java-object-to-object-mapping 
注意到許多工具採用靜態化的產生java位元組碼的方式,這樣和hardcode效能所差無幾了。 

id 描述 是否支援flattern 最新版本 URL
Transmorph 只是不同類型間的互轉,和需求相去勝遠 N 3.1.3 https://github.com/cchabanois/transmorph
Commons-Lang ArrayUtils也只是不同類型間的互轉 N 3.1 http://commons.apache.org/proper/commons-lang/javadocs/api-release/org/apache/commons/lang3/ArrayUtils.html
Commons-Convert 也只是不同類型間的互轉,目前在apache的sandbox裡 N 1.0-SNAPSHOT http://commons.apache.org/sandbox/commons-convert
Spring framework PropertyEditors也只是不同類型間的互轉 N  
EZMorph 能同類型同名屬性批量copy N 1.0.6 http://sourceforge.net/projects/ezmorph/
Commons-BeanUtils BeanUtils只能同類型同名屬性批量copy,PropertyUtils可以用類似ognl運算式copy嵌套的屬性,但這個東西的效能被吐槽不好 Y 1.8.3 http://commons.apache.org/proper/commons-beanutils/
Morph 沒找到文檔   1.1.1 http://sourceforge.net/projects/morph/
Lorentz 似乎死了    
OTOM "Autumn"沒找到文檔     https://java.net/projects/otom
Smooks 沒找到文檔,貌似可以多種格式比如csv,java bean,jms訊息互轉,不是我們的需求情境     https://github.com/smooks/smooks http://www.infoq.com/cn/articles/event-streaming-with-smooks
JMapper 支援annotaion描述映射 N 1.2 http://code.google.com/p/jmapper-framework/
cglib BeanCopier, BulkBean,BeanMap,FastClass/FastMethod 採用產生位元組碼的方法,效能相當的高 N 2.3 sourceforge.net/projects/cglib
ognl ognl運算式肯定功能強大 Y 4.0-SNAPSHOT http://commons.apache.org/proper/commons-ognl/
mapping4java 國人造的一個輪子,效能不錯 N 1.0 http://code.google.com/p/mapping4java/
Dozer 貌似功能比較強大,可通過xml來配置映射,但效能不行 Y 5.4 https://github.com/DozerMapper/dozer
Orika 一個新秀,比Dozer效能好,可以一試,但沒找到配xml的方法 Y 1.4.2 http://orika-mapper.github.io/orika-docs/index.html
ModelMapper 採用約定優於配置的方式自動對應 Y 0.5.6 http://modelmapper.org

java bean 轉換工具

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.