#3815: chore(docs): Improved wording about @Condition usage

This commit is contained in:
fml2 2025-05-10 14:12:20 +02:00 committed by GitHub
parent 39551242d7
commit d5f825193c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -308,7 +308,7 @@ Conditional mapping can also be used to check if a source parameter should be ma
A custom condition method for properties is a method that is annotated with `org.mapstruct.Condition` and returns `boolean`. A custom condition method for properties is a method that is annotated with `org.mapstruct.Condition` and returns `boolean`.
A custom condition method for source parameters is annotated with `org.mapstruct.SourceParameterCondition`, `org.mapstruct.Condition(appliesTo = org.mapstruct.ConditionStrategy#SOURCE_PARAMETERS)` or meta-annotated with `Condition(appliesTo = ConditionStrategy#SOURCE_PARAMETERS)` A custom condition method for source parameters is annotated with `org.mapstruct.SourceParameterCondition`, `org.mapstruct.Condition(appliesTo = org.mapstruct.ConditionStrategy#SOURCE_PARAMETERS)` or meta-annotated with `Condition(appliesTo = ConditionStrategy#SOURCE_PARAMETERS)`
e.g. if you only want to map a String property when it is not `null`, and it is not empty then you can do something like: e.g. if you only want to map a String property when it is not `null` and not empty then you can do something like:
.Mapper using custom condition check method .Mapper using custom condition check method
==== ====