Frage

Given that a bean mapper is used to map a Business Modell of into a DTO model and vice versa: Which one do provide easy ways to convert property paths?

Lets say my business logic reports that "person.street.number" is mandatory and now I want tell the client this in the correct way, i.e. as "personDto.streetnumber"?

I'm pretty sure every bean mapper has this knowledge, but which one provide easy ways to access this knowledge?

Based on this excellent list of bean mappers and further reading on their websites if found ModelMapper and Orika to look pretty attractive.

War es hilfreich?

Lösung

ModelMapper seems to offer good ways to access this information. Depending on the configuration, most specifically the MatchingStrategy, ModelMapper will automatically convert values from source paths to destination paths so long as they match.

To access this information one can use ModelMapper.getTypeMap and TypeMap.getMappings.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top