См. следующий класс
public class Parent {
private String name;
private int age;
private Date birthDate;
// getters and setters
}
Предположим, что я создал родительский объект следующим образом
Parent parent = new Parent();
parent.setName("A meaningful name");
parent.setAge(20);
Обратите внимание, что в соответствии с кодом, приведенным выше, свойство birthDate равно null. Теперь я хочу копировать ТОЛЬКО ненулевые свойства от родительского объекта к другому. Что-то вроде
SomeHelper.copyNonNullProperties(parent, anotherParent);
Мне нужно это, потому что я хочу обновить объект anotherParent, не переопределяя его значение null с нулевыми значениями.
Знаете ли вы какого-нибудь помощника, подобного этому?
Я принимаю минимальный код в качестве ответа, не имеет ли в виду помощника
С уважением,