I can't speak to how ModelMapper works as compared to Dozer, but I can certainly describe ModelMapper.
First, have a look at the How it Works
page in the docs, which describes how ModelMapper's implicit matching process works. For each source and destination type, ModelMapper creates a TypeMap
which contains mappings
that are either created implicitly by ModelMapper (as determined by the property matching process
) or explicitly by user supplied PropertyMaps
. Mappings describe exactly which path through the source object graph matches which path in the destination object graph (ex: Company.employee.address.street -> CompanyDTO.employeeStreetAddress), as well as other information.
When ModelMapper.map is called, the TypeMap for the source and destination types is looked up and values are mapped accordingly
. If no TypeMap exists for the source and destination types, one is created on the first map call and is reused thereafter. Mapping is an efficient process since all of the information needed to copy property values from an object of the source type to an object of the destination type is already captured in the TypeMap.
Hope that helps,