Skip to main content

Posts

Recent posts

Mapping with ObjectMapper

Converting from one object structure to another is often time consuming, without adding real value. I recently came across the Modelmapper library, which reduces this task to a minimum. Add the dependency below to either your gradle og pom file. Gradle compile "org.modelmapper:modelmapper:2.3.0" Maven <dependency>   <groupId>org.modelmapper</groupId>   <artifactId>modelmapper</artifactId>   <version>2.3.0</version> </dependency> ModelMapper configuration  There is a wide range of configuration options, which can be found here ModelMapper Internal basket object public class Basket {   private UUID id;   private String productCode;   private String customerName;   private String orderContactEmail;   private String orderContactPhoneNo;   // Assume getters and setters } External Basket object public class BasketDTO {   private String id;   private String productNo;   private String customerN