Let’s suppose I have classes: I have an instance of B called b and want to map to A (to get rid of z property as it’s getting serialized later). I was trying to do; But as a result I am getting the the same type B object. I suspect it could be because B is a subclass of A,
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
Issue when mapping Collection of List using ModelMapper in Spring Boot
I have a Project domain which I want to map on a ProjectDTO using modelmapper. The Project domain contains a List of Locations. In the DTO, I don’t want the Location domains, just the ids of the locations. So I followed the tutorial of Link and created a custom converter: Then, I created the PropertyMap to tell modelmapp to use
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.