Closed eiswind closed 7 years ago
You can use @Mapper(nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
. With this the source properrties are always checked and assigned if they are not null
.
Thx. I added the NullValueCheckStrategy. Null values now map to the protobuf defaults. I added the testcase to illustrate the behaviour.
See also #14
I just pushed the changes. Thx for the feedback.
@eiswind Thanks a lot for the example. I think that it is a really nice addition.
Regarding my https://github.com/mapstruct/mapstruct-examples/pull/25#discussion_r115608662. If you think that it is worth it and it is OK for you, I can add that to your PR, or create a new one, that will do that.
Additionally you had some questions in one of the issues, about not needing to use permissionsList
. Do you think that it would be better if you didn't need to write @Mapping(source = "permissions", target = "permissionsList")
?
Finally, will it be OK for you if I squash all the commits into one before merging, or you would prefer to have them as is merged into the examples?
Feel free to make your changes as you prefer!
Thanks for the PR @eiswind, sorry for taking so long to merge it.
Null values don't work, as this is not supported in the Builder.