I use ModelMapper in my project to map between DTO classes and models.
For example:
public class UserDto {
private String name;
private String phone;
private String email;
}
public class User {
@Id
private String id;
private String metaDatal;
private String name;
private String phone;
private String email;
}
Here How I map it:
@Autowired
private ModelMapper modelMapper;
modelMapper.map(userDto, user);
As you can see I have metaDatal field in the user model, I want to set this field with a specific value.
Specific field(metaDatal) of the mapped class I want to set this value "abc123". Is there any way to tell map method when it called that, specific filed(for example metaData) should have specific value(for example abc123)?