Replies: 1 comment 1 reply
-
Mapperly always uses the first matching mapping when mapping one type to another. Mappings in the same class are preferred over mappings from other classes included with |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are running into an issue with mapperly, and I'l like to discuss with you if this is a bug or not. Suppose I have the following classes I want to map:
And I want to have a custom before/after map for the mapping from OtherClass to OtherTargetClass, so my mapping configuration looks like:
The problem here, is that the mapping generator now generates the following for the mapping for the
MyTargetClass
mapping:As you can see, the mapper ignores my
Map
method which has custom mapping logic. I think the mapper should prioritize public mapping methods over private mapping methods, because now I end up with a partially mappedTargetClass
without any mention of issues.This particularly becomes a problem when the sub class in my example is completely auto mapped at first, and gets a custom mapping method later on. There is no warning whatsoever that other mappings will break because of this
What are your thoughts on this?
Beta Was this translation helpful? Give feedback.
All reactions