You need to have a Set Expression on mappedProperty that contains the mapping logic for that property. Below is a sample Groovy snippet
model.propB ? model.propB : model.propA
The snippet follows the scenario you provided. It basically means if model.propB is not null or not empty, map model.propB to mapped property, else map model.propA
Custom mapping in Gloop
Custom mapping in Gloop
In my Gloop service, I want to add a custom mapping logic where it will only map a property to the target property only if the condition matches using the following scenario.
Scenario 1:
model.propA = 1
model.propB = 2
Then:
mappedProperty = 2
Scenario 2:
model.propA = 1
model.propB = null
Then:
mappedProperty = 1