I am planning to write a method which use to update a MyObject
object with not null fields of another MyObject
object.
private void updateMyObject(MyObject sourceObject, MyObject destinationObject) {
ModelMapper mapper = new ModelMapper();
mapper.getConfiguration().setPropertyCondition(Conditions.isNotNull());
mapper.map(sourceObject, destinationObject);
}
public class MyObject {
long id;
long durationInMilliSecounds;
//...getters and setters
}
In here destinationObject
is not getting updated. Can anybody suggest the issue of this code.