17 April 2016

Dozer DTO assembler (edit)

Dozer is a nice little object mapper. It moves data from one object to another.

Dozer can be used as a generic Data Transfer Object assembler. You specify your mappings in an XML file. By default it copies data to properties with the same names, unless you add specific field mappings.


Next you call dozer in your code to move your data:
public Kloon getDto (Original o) {
  return dozerMapper.map(o, Kloon.class);
Dozer can reverse map from class-b to class-a as well. There is an annotation based mapping mechanism which works well for simple cases.