RSS Feed for This PostCurrent Article

Java: Open Source Object Mapping Library

Here are some libraries for object to object mapping in Java.

Dozer

Dozer is a 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.

Dozer supports simple property mapping, complex type mapping, bi-directional mapping, implicit-explicit mapping, as well as recursive mapping. This includes mapping collection attributes that also need mapping at the element level.

Dozer not only supports mapping between attribute names, but also automatically converting between types. Most conversion scenarios are supported out of the box, but Dozer also allows you to specify custom conversions via XML.

The mapper is used any time you need to take one type of Java Bean and map it to another type of Java Bean. Most field mapping can be done automatically by Dozer using reflection, but any custom mapping can be predescribed in XML format. Mapping is bi-directional so only one relationship between classes needs defining. If any property names on both objects are the same you do not even need to do any explicit property mapping for these fields.

Transmorph

Transmorph is a free java library used to convert a Java object of one type into an object of another type (with another signature, possibly parameterized).

Transmorph strong points are :

  • support conversion for primitives and objects
  • support conversion to multidimensional arrays
  • support conversion to parameterized collections and types
  • support conversion for beans that contain bi-directional relationships
  • you can choose exactly which converters you want to use
  • jars for JDK 1.4 and JDK 1.5
  • no dependencies
  • 40 converters included
  • easy to add more converters
  • objects can be modified after conversion using modifiers
  • can convert to a type given either its java type (Class) or signature
  • easy to use


Trackback URL


1 Trackback(s)

  1. From Java: Open Source Object Mapping Library | paydayloan | Feb 10, 2009

Sorry, comments for this entry are closed at this time.