private ModelMapper mapperFromDto;
private ModelMapper mapperFromEntity;
public ModelMapperListMapper() {
mapperFromDto = new ModelMapper();
mapperFromDto.addMappings(new PropertyMap<PersonWithHistoryDTO, Person>() {
@Override
protected void configure() {
map().getName().setFirstname(source.getFirstName());
map().getName().setSurname(source.getLastName());
}
});
mapperFromEntity = new ModelMapper();
mapperFromEntity.addMappings(new PropertyMap<Person, PersonWithHistoryDTO>() {
@Override
protected void configure() {
map().setFirstName(source.getName().getFirstname());
map().setLastName(source.getName().getSurname());