Mapstruct - mapping field using a mathematical formula (e.g. target="x", source="a+b")
<p>I am using mapstrcut to map my entities to dto, I am now facing a problem that in the DTO there is an extra field which is "discount", and I need mapstruct to manage filling this field, and this field is calculated based on 2 values (salePrice and retailPrice).</p>

<p>My question how can I do this kind of mapping like using mapstruct.</p>

<pre><code>@Mapping(target="discount", source="retailPrice-salePrice")
</code></pre>

<p>When I tried adding this line the code break while building says:</p>

<pre><code> error: No property named "salePrice*retailPrice" exists in source parameter(s).
            @Mapping(source="salePrice*retailPrice", target="discount")
</code></pre>

<p>So How can I do such mapping?</p>