any tool for java object to object mapping? [closed] Ask Question

any tool for java object to object mapping? [closed] Ask Question

I am trying to convert DO to DTO using java and looking for automated tool before start writing my own. I just wanted to know if there any free tool available for the same.

ベストアンサー1

There are some libraries around there:

  • Commons-BeanUtils: ConvertUtils -> Utility methods for converting String scalar values to objects of the specified Class, String arrays to arrays of the specified Class.

  • Commons-Lang: ArrayUtils -> Operations on arrays, primitive arrays (like int[]) and primitive wrapper arrays (like Integer[]).

  • Spring framework: Spring has an excellent support for PropertyEditors, that can also be used to transform Objects to/from Strings.

  • Dozer: Dozer is a powerful, yet simple Java Bean to Java Bean mapper that recursively copies data from one object to another. Typically, these Java Beans will be of different complex types.

  • ModelMapper: ModelMapper is an intelligent object mapping framework that automatically maps objects to each other. It uses a convention based approach to map objects while providing a simple refactoring safe API for handling specific use cases.

  • MapStruct: MapStruct is a compile-time code generator for bean mappings, resulting in fast (no usage of reflection or similar), dependency-less and type-safe mapping code at runtime.

  • Orika: Orika uses byte code generation to create fast mappers with minimal overhead.

  • Selma: Compile-time code-generator for mappings

  • JMapper: Bean mapper generation using Annotation, XML or API (seems dead, last updated 2 years ago)

  • Smooks: The Smooks JavaBean Cartridge allows you to create and populate Java objects from your message data (i.e. bind data to) (suggested by superfilin in comments). (No longer under active development)

  • Commons-Convert: Commons-Convert aims to provide a single library dedicated to the task of converting an object of one type to another. The first stage will focus on Object to String and String to Object conversions. (seems dead, last update 2010)

  • Transmorph : Transmorph は、あるタイプの Java オブジェクトを別のタイプのオブジェクト (別のシグネチャを持ち、パラメーター化されている可能性あり) に変換するために使用される無料の Java ライブラリです。 (廃止されたようです。最終更新は 2013 年)

  • EZMorph : EZMorph は、オブジェクトを別のオブジェクトに変換するためのシンプルな Java ライブラリです。プリミティブとオブジェクトの変換、多次元配列の変換、DynaBeans を使用した変換をサポートしています (現在は廃止されているようです。最終更新は 2008 年)

  • Morph : Morph は、アプリケーションの内部相互運用性を容易にする Java フレームワークです。情報がアプリケーション内を流れると、複数の変換が行われます。Morph は、こ​​れらの変換を実装する標準的な方法を提供します。 (現在は使用されていないようです。最終更新は 2008 年)

  • Lorentz : Lorentz は、汎用的なオブジェクト間変換フレームワークです。あるタイプの Java オブジェクトを別のタイプのオブジェクトに変換するためのシンプルな API を提供します。 (廃止されたようです)

  • OTOM : OTOM を使用すると、任意のオブジェクトから任意のデータを他のオブジェクトにコピーできます。可能性は無限です。「秋」へようこそ。(死んだようです)

おすすめ記事