Java ModelMapper: Flattening and vice versa This is a sample of how to transform a complex object to a flatten one and the opposite using ModelMapper (Java).