Dozer is a nice little object mapper. It moves data from one object to another.
<mapping> <class-a>z.Original</class-a> <class-b>a.Kloon</class-b> <field> <a>identity</a> <b>uid</b> </field> </mapping>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.
MapStruct is a good annotation driven alternative.
No comments:
Post a Comment