-
-
Notifications
You must be signed in to change notification settings - Fork 946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DeepClone mapping control not generating second tier functions to clone for objects stored in collection-type content #3516
Comments
Looked into it a bit, but not sure how to fix this. Here is a work-around: @Mapper( componentModel = "spring", mappingControl = DeepClone.class )
public abstract class PersonMapper {
@BeanMapping( nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS )
public abstract Person clonePerson(Person person);
} The problem is that the If the |
Thanks for looking into this @Zegveld. I also think that it would be a bit tricky to solve this. I'll move it to 1.7 to see if we can do something there. In any case, the approach by using the mapping control in |
Expected behavior
In 1.5.3.Final DeepClone is not working if second thier objects are stored in collection type content.
Let's say, we have nested objects as follows:
Person -> List
Expectation is, when calling clonePerson on person, since it's a deepCopy, the addresses will also be cloned.
i.e. the following test should hold:
Please compare this to the behavior in #3135
Actual behavior
Generated code is:
I.e. an addressToAddress method is missing and not called in the for loop copying the list.
In contrast, when replacing the original Person by this definition, an addressToAddress method is generated (so here we have expected behavior):
Steps to reproduce the problem
MapStruct Version
1.5.5-Final
The text was updated successfully, but these errors were encountered: