I have some data in input that I'll have to use to set all properties of a POJO. The POJO might be partially set. My problem is to set the property only if related input data is not null. I know I can do this in two ways:
if (input != null) {
obj.setData(input);
}
or
obj.setData(input != null ? input : obj.getData());
I'm looking for a solution less ugly and better for objects with a big number of properties to set.