I want to use mapstruct as follows:
@Mapping(target = ".", source = "object1.subobject2.subobject3")
public abstract Object4 toObject(Object1 object1);
As Object1 resp. its subobject3 has the same properties as my resulting type Object4 i want it directly as mapping target. Is the "."-operator currently a valid option or do iy have to declare all properties from "object1.subobject2.subobject3"?
The current mapping target or "." can be used in the Mapping#target starting from 1.4.
At the time of answering this question, this is version 1.4.0.CR1.
It should work exactly like you have written in your question.
More information about this can be read in Mapping nested bean properties to current target
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With