Given the following to models
class Project {
String groupId;
String artifactId;
String version;
}
class ProjectWithId {
String id;
String groupId;
String artifactId;
String version;
}
How would I use ModelMapper correctly to combine the values of groupId, artifactId and version? E.g. is there some way to avoid the following:
ProjectWithId projectWithId = modelMapper.map(project, ProjectWithId.class);
projectWithId.setId(project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion());
You need to create Custom Converter to combine 3 properties i.e. groupId,artifactId and version.
For e.g.
Use this converter while mapping