From my point of view, the configuration or java code to map some special properties are always needed.
Here I want to take a DO
and DTO
for example
DO:{
id: "id",
name:"name",
doName1: "doName1",
nestedObj: {
id: "nestedObjId",
name: "nestedObjName"
}
}
DTO{
id: "",
name: "",
name1: "" // for mapping doName1 in DO.
nestedId: "", //for DT.nestObj.id
nestedName: "", //for DT.nestObj.name
}
For Dozer or Orika they both can automatically match id and name property between DO and DTO without any configuration or java code because they are with the same property names and types.
But if you want to DO.doName1
<----> DTO.name1
or DO.nestedObj.id
<--->DTO.nestedId
you need to make some configuration (via xml or java) to tell the mapping tool you are intend to do that.
I think for your use case, Dozer, Orika and ModelMapper are all OK. But for me I am switching my project from dozer to Orika for performance purpose. Although Orika is not so mature as dozer, not so intelligence and requires me to do a lot additional job to maintain my customized mapping configurations.
If your project not too care about performance I will recommend you dozer, it’s so easy to use and support so many advanced features. Otherwise if you are purchasing high performance, i suggest you orika.