1 19 20 package org.apache.cayenne.graph; 21 22 import org.apache.cayenne.util.Util; 23 24 28 public class NodePropertyChangeOperation extends NodeDiff { 29 30 protected String property; 31 protected Object oldValue; 32 protected Object newValue; 33 34 public NodePropertyChangeOperation(Object nodeId, String property, Object oldValue, 35 Object newValue) { 36 37 super(nodeId); 38 this.property = property; 39 this.oldValue = oldValue; 40 this.newValue = newValue; 41 } 42 43 public NodePropertyChangeOperation(Object nodeId, String property, Object oldValue, 44 Object newValue, int diffId) { 45 super(nodeId, diffId); 46 47 this.property = property; 48 this.oldValue = oldValue; 49 this.newValue = newValue; 50 } 51 52 55 public boolean isNoop() { 56 return Util.nullSafeEquals(oldValue, newValue); 57 } 58 59 public void apply(GraphChangeHandler tracker) { 60 tracker.nodePropertyChanged(nodeId, property, oldValue, newValue); 61 } 62 63 public void undo(GraphChangeHandler tracker) { 64 tracker.nodePropertyChanged(nodeId, property, newValue, oldValue); 65 } 66 } 67 | Popular Tags |