CycleAvoidingMappingContext and Lombok Builder #3958
Replies: 1 comment
-
|
Upon further reflection, it seems like |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
As noted in other issue threads (mapstruct/mapstruct-examples#119), the reference implementation of the
CyclicGraphContextdoes not play well with the Lombok Builder annotation.The main issue being that the context will attempt to store the Builder class instead of the target DTO type. Part of why this happens is because the
storeMappedInstancemethod is annotated with@BeforeMapping. I found that annotating with@AfterMappingwith a@MappingTargetparameter, the context would correctly store the actual target type after calling.build().My question is - is there a reason why
@BeforeMappingis suggested in the referenced implementation? Is there any reason to avoid using@AfterMappingin this situation?Beta Was this translation helpful? Give feedback.
All reactions