public void writePropertyDirectly(Object object, Object oldValue, Object newValue) throws PropertyException { delegate.writePropertyDirectly(object, oldValue, newValue); } }
public boolean visitAttribute(AttributeProperty property) { property.writePropertyDirectly(to, property.readPropertyDirectly(to), property.readPropertyDirectly(from)); return true; }
public boolean visitAttribute(AttributeProperty property) { ObjAttribute attr = property.getAttribute(); String dbAttrPath = attr.getDbAttributePath(); Object value = snapshot.get(dbAttrPath); property.writePropertyDirectly(object, null, value); // note that a check "snaphsot.get(..) == null" would be incorrect in this // case, as NULL value is entirely valid; still save a map lookup by // checking for the null value first if (value == null && !snapshot.containsKey(dbAttrPath)) { isPartialSnapshot[0] = true; } return true; }
public boolean visitAttribute(AttributeProperty property) { String dbAttrPath = property.getAttribute().getDbAttributePath(); // supports merging of partial snapshots... // check for null is cheaper than double lookup // for a key... so check for partial snapshot // only if the value is null Object newValue = snapshot.get(dbAttrPath); if (newValue != null || snapshot.containsKey(dbAttrPath)) { Object curValue = property.readPropertyDirectly(object); Object oldValue = diff != null ? diff.getSnapshotValue(property .getName()) : null; // if value not modified, update it from snapshot, // otherwise leave it alone if (Util.nullSafeEquals(curValue, oldValue) && !Util.nullSafeEquals(newValue, curValue)) { property.writePropertyDirectly(object, oldValue, newValue); } } return true; }
property.writePropertyDirectly(object, null, value);