Skip to content
Advertisement

Tag: modelmapper

ModelMapper: apply rule to all fields of type

I have a DTO with a lot of String fields (some are of other types). When mapping objects into objects of another similar class, I need to apply a transformation to all fields of type String, in this case – trim(). So, I have: What I’ve tried: Is there a way to specify all String fields of a class at

Why does ModelMapper map collections merge-style?

In my application I am mapping data transfer objects to entities using the ModelMapper library. One entity Library has a collection (java.util.Set) containing other entities Book. A user should be able to change the collections contents. In this case a data transfer object UpdateDTO is used that contains the identifiers of the entities Book to be stored in the collection.

Advertisement