Skip to content
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

create method copyNonNullProperties #314

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

XiongDWM
Copy link

@XiongDWM XiongDWM commented Nov 14, 2024

When updating an entity, only a subset of properties may be provided (e.g., For a person entity[name: String, age: Integer, gender: boolean, address: String] while only the name and age are provided, or says we only want to update person's name and age, and other properties like gender or address are null). In such cases, copying all properties including null values will overwrite the existing values in the target object, which is not desirable, some would say we can use setters to set the changing properties to the origin entity, but what if 10 properties need to change? This feature will prevent null values from overwriting existing values in the target object, ensuring that only the provided properties are updated without coding too much by use setter.

@F0otman
Copy link

F0otman commented Nov 20, 2024

how about expand method doesn't copy empty properties as well

@XiongDWM
Copy link
Author

how about expand method doesn't copy empty properties as well

you mean properties like empty string or empty collection? sure tho

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.

2 participants