Skip to content

Instantly share code, notes, and snippets.

@TobseF
Last active July 6, 2020 07:43
Show Gist options
  • Save TobseF/7950ce0f15efb11a30c808a1b6506f93 to your computer and use it in GitHub Desktop.
Save TobseF/7950ce0f15efb11a30c808a1b6506f93 to your computer and use it in GitHub Desktop.
Mapstruct AnnotationParser Example
class BusinessModel{
String zip;
}
class UiModel{
String plz;
}
public interface ModelMapping extends BridgeMapping<BusinessModel, UiModel> {
@Mapping(source = "zip", target = "plz")
UiModel modelToUiModel(BusinessModel model, @MappingTarget UiModel uiModel);
}
@Test
public testMappingInfo(){
MapStructParser mappingInfo = new MapStructParser();
mappingInfo.parseMappingInterface(ModelMapping.class);
assertEquals("zip", mappingInfo.mapToTargetField("plz"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment