Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mapstruct: use "." as target property - is it currently supported?

Tags:

java

mapstruct

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"?

like image 286
Bernado Avatar asked Oct 24 '25 18:10

Bernado


1 Answers

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

like image 137
Filip Avatar answered Oct 26 '25 08:10

Filip



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!