The documentation is mentioning a nullValuePropertyMapping, but it does not exist for @BeanMapping. Only a nullValueMappingStrategy exists, but then I don't have any ignore option.
I have created an update method in my mapper, and it will only be used for partial updates:
@BeanMapping()
void updateSubmissionFromSubmissionApiDTO(SubmissionApiDTO dto, @MappingTarget Submission entity);
If a source property has a null value, which is typical for partial updates, the target property will get a null value as well. That's a problem, because I want it to be ignored. The only options I have is to use an nullValueMappingStrategy with either RETURN_DEFAULT or NULL.
The documentation is saying that I can use nullValuePropertyMapping for @BeanMapping, but it's not available:
"By specifying nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE on @Mapping, @BeanMapping, @Mapper or @MappingConfig, the mapping result will be equal to the original value of the @MappingTarget annotated target."
Several others have pointed out the same problem, that this option is gone in later versions of MapStruct:
If I take a look in the source code, it's definitely there:
But not in my local version of BeanMapping.class, built by Maven (version 1.4.1.Final).