To write down the minimum required code, I try to let ModelMapper generate its implicit mapping and write only explicit property mappings for those properties that it could not auto-arm.
If I can let ModelMapper generate an implicit mapping using:
modelMapper.createTypeMap(SourceType.class, DestType.class);
he complains about setSomeIdhaving several possible mappings. Then I tried to fix this using:
modelMapper.addMappings(new PropertyMap<SourceType, DestType>() {
protected void configure() {
map().setSomeId(source.getProperty().getWeirdID());
}
});
However, I found that ModelMapper is still complaining, because in fact the exception throws itself at createTypeMap, so it has no way to reach my custom match code.
If I invert both operators, I get an error message:
java.lang.IllegalStateException: TypeMap SourceType DestType
createTypeMap, ModelMapper DestType (, createTypeMap).
, .
- ?