How can I set values into an existing
object only if the incoming
fields are not null? On form submission, I check to see if incoming fields are not null, before updating the existing object on a database save. I have too many fields and too many snippets for each field. Is there an elegant way to set only the updated fields on the existing
object?
protected void updateFoo(Foo input, Foo existing) {
if (input.getEducation() != null) {
existing.setEducation(input.getEducation());
}
...
}