Reputation: 1948
There are several ways to ignore unmapped target properties in mapstruct.
@Mapping(target = "propName", ignore = true)
@Mapper(
unmappedTargetPolicy = ReportingPolicy.IGNORE
)
Is there a way to mix these approaches and ignore all properties at the method level without explisently list all of them?
Upvotes: 8
Views: 10814
Reputation: 323
if you are using version 1.4, you can annotate your mapping method with @BeanMapping(ignoreByDefault = true)
Upvotes: 2
Reputation: 1506
Using the BeanMapping
annotation you can specify this at method level.
@BeanMapping(unmappedTargetPolicy = ReportingPolicy.IGNORE)
The javadoc can be found here.
Upvotes: 13