remap
remap copied to clipboard
Support for hierarchy
This is a feature proposal.
I have Pet, Dog and Cat entity classes. Dog and Cat classes extend Pet. I also have the equivalent PetDTO, DogDTO and CatDTO.
I would like to map a PetDTO entity and get a Dog or a Cat entity in return.
Very similar to this in mapstruct: https://github.com/mapstruct/mapstruct/issues/366
Yes ReMap should support type hierarchy. I will analyse the mapstruct example. A while ago there was a proof-of-concept #114 maybe that is a good basis to start.
In fact, every mapper is having issues with hierarchy (e.g. https://github.com/modelmapper/modelmapper/issues/182) so it could be a very distinctive feature for remap :)
For what it's worth, I implemented a Mapper for hierarchies using a combination of updating and creating mappers, as illustrated in this StackOverflow post: https://stackoverflow.com/questions/59727793/java-mapping-dtos-hierarchy-using-mapstruct/67622805