I have a Spring Boot project and I'm using mapstruct to map 2 objects. And I have this king of structure, this is the first object:
ObjectA {
List<ObjectB> objectsB;
}
ObjectB {
String prId;
List<String> dtId;
}
---
The second object:
ObjectC {
List<ObjectD> objectsD;
}
ObjectD {
ObjectE objectE;
List<ObjectE> objectsE;
}
ObjectE {
String nmId;
}
And now using mapstruct I need to do this:
@Mapper(componentModel = "spring")
public interface AppMapper {
@Mappings({
@Mapping(target = "objectC.objectsD.objectE.nmId", source = "objectA.objectsB.prId"),
@Mapping(target = "objectC.objectsD.objectsE.nmId", source = "objectA.objectsB.dtId")
})
ObjectC objectAToObjectC(ObjectA objectA);
}
How can I do it? Any feedback will be apreciated! Thank you!
@AfterMapping