Skip to content

Added ability to apply patch to existing list inplace #152

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

Merged
merged 3 commits into from
Sep 1, 2022
Merged

Added ability to apply patch to existing list inplace #152

merged 3 commits into from
Sep 1, 2022

Conversation

andre161292
Copy link
Contributor

@andre161292 andre161292 commented Jul 28, 2022

Motivation

I'm using java-diff-utils to update lists in JPA models from a DTOs. As Hibernate uses proxies and records any removal/add/swap, but has it's problems when using clear/addAll, this is the only option to make patching my lists work.

In older versions i accessed AbstractDelta's applyTo directly, but that fell away when it was made hidden in 3075742.

Changes

I added a the methods applyToExisting and it's opposite restoreToExisting to Patch, to make it possible to update lists in-place and updated JavaDoc accordingly.

Minor improvements

I corrected a typo in the method-name verifyAntApplyTo -> verifyAndApplyTo

André Dörscheln added 3 commits July 28, 2022 11:57

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@wumpz
Copy link
Collaborator

wumpz commented Aug 16, 2022

But as I understand it, you did not add but change the existing behaviour, right?

@andre161292
Copy link
Contributor Author

But as I understand it, you did not add but change the existing behaviour, right?

No, i didn't change the existing behavior. I extracted the core functionality to make it accessible from the outside, that's why it looks changed at first.

@wumpz wumpz merged commit 7d0fd54 into java-diff-utils:master Sep 1, 2022
@andre161292 andre161292 deleted the feature/apply-to-original-collection branch September 1, 2022 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants