public class ModelObjectDelta extends Object implements IModelObjectDelta
ADDED, CHANGED, CHILD_CHANGED, CLASS_CHANGED, DIFFERENT_OBJECT_AT_POSITION, EMPTY, MOVED, PROPERTY_CHANGED, REMOVED, STRUCTURE_CHANGED| Modifier and Type | Method and Description |
|---|---|
void |
accept(IModelObjectDeltaVisitor visitor)
Accepts the given visitor.
|
void |
addChildDelta(IModelObjectDelta childDelta)
Adds the child delta to this delta and sets this delta's kindOfChange accordingly.
|
void |
checkPropertyChange(String property,
boolean value1,
boolean value2,
IDeltaComputationOptions options) |
void |
checkPropertyChange(String property,
char value1,
char value2,
IDeltaComputationOptions options) |
void |
checkPropertyChange(String property,
double value1,
double value2,
IDeltaComputationOptions options) |
void |
checkPropertyChange(String property,
float value1,
float value2,
IDeltaComputationOptions options) |
void |
checkPropertyChange(String property,
int value1,
int value2,
IDeltaComputationOptions options) |
void |
checkPropertyChange(String property,
Object value1,
Object value2,
IDeltaComputationOptions options) |
static void |
createAssociatedChildDeltas(ModelObjectDelta delta,
IModelObject original,
IModelObject refObject,
String association,
IDeltaComputationOptions options) |
static void |
createAssociatedChildDeltas(ModelObjectDelta delta,
List<? extends IModelObject> originals,
List<? extends IModelObject> refObjects,
String association,
IDeltaComputationOptions options) |
static void |
createChildDeltas(ModelObjectDelta delta,
IModelObject original,
IModelObject refObject,
String association,
IDeltaComputationOptions options) |
static void |
createChildDeltas(ModelObjectDelta delta,
List<? extends IModelObject> originals,
List<? extends IModelObject> refObjects,
String association,
IDeltaComputationOptions options) |
String |
getAssociation()
The name of the association in which the object has been added, removed or changed.
|
AssociationKind |
getAssociationKind()
Returns the kind of association if this delta has any incoming association, that means it is
part of a composite or the object is associated from another object.
|
List<String> |
getChangedProperties()
Returns the properties that have a different value in the model object and the reference
model object.
|
List<IModelObjectDelta> |
getChildDeltas()
Returns deltas for all children of the model object which were added, removed, or changed.
|
List<IModelObjectDelta> |
getChildDeltas(int kind)
Returns deltas for all children of this model object whose kind is included in the given
mask.
|
int |
getKind()
Returns the kind of change.
|
int |
getKindOfChange()
If delta's kind is
IModelObjectDelta.CHANGED, this method returns the kind of changed defined by the
constant listed below. |
IModelObject |
getOriginalObject()
The model object this delta is computed for.
|
IModelObject |
getReferenceObject()
The model object that is taken as a reference to which the orginal model object is compared
to.
|
boolean |
isAdded()
Returns
true if this model object has been added to its parent,
false otherwise. |
boolean |
isChanged()
Returns
true if this model object has been changed. |
boolean |
isChildChanged()
Returns
true if at least one model object's children has been changed. |
boolean |
isClassChanged()
Returns
true if the model object's Java class has "changed". |
boolean |
isDifferentObjectAtPosition()
Returns
true if a different model object is at a position, otherwise
false. |
boolean |
isEmpty()
Returns
true if the delta is empty, the two objects are the same, otherwise
false. |
boolean |
isMoved()
Returns
true if this model object has changed its position in the ordered
association. |
boolean |
isPropertyChanged()
Returns
true if at least one the model object's properties has changed,
otherwise false. |
boolean |
isPropertyChanged(String propertyName)
Returns
true if the model object contains a different value for the given
property than the reference model object. |
boolean |
isRemoved()
Returns
true if this model object has been removed from its parent,
false otherwise. |
boolean |
isStructureChanged()
Returns
true if this model object's structure has changed. |
void |
markMoved()
Marks the delta as one where the object has changed its position.
|
void |
markPropertyChanged(String property)
Marks the given property as having a different value in the model object and the reference
model object.
|
static ModelObjectDelta |
newAddDelta(IModelObject addedObject,
String association,
AssociationKind associationKind,
IDeltaComputationOptions options) |
static ModelObjectDelta |
newAddDelta(IModelObject addedObject,
String association,
IDeltaComputationOptions options)
Deprecated.
since 19.12. Use
newAddDelta(IModelObject, String, AssociationKind, IDeltaComputationOptions)
instead. |
static ModelObjectDelta |
newChangeDelta(IModelObject original,
IModelObject refObject,
int kindOfChange) |
static ModelObjectDelta |
newDelta(IModelObject object,
IModelObject refObject,
IDeltaComputationOptions options) |
static ModelObjectDelta |
newDifferentObjectAtPositionChangedDelta(IModelObject original,
IModelObject refObject,
String association)
Deprecated.
since 19.12. Use
newDifferentObjectAtPositionChangedDelta(IModelObject, IModelObject, String, AssociationKind)
instead. |
static ModelObjectDelta |
newDifferentObjectAtPositionChangedDelta(IModelObject original,
IModelObject refObject,
String association,
AssociationKind associationKind) |
static ModelObjectDelta |
newEmptyDelta(IModelObject object,
IModelObject refObject) |
static ModelObjectDelta |
newRemoveDelta(IModelObject removedObject,
String association,
AssociationKind associationKind,
IDeltaComputationOptions options) |
static ModelObjectDelta |
newRemoveDelta(IModelObject removedObject,
String association,
IDeltaComputationOptions options)
Deprecated.
since 19.12. Use
newRemoveDelta(IModelObject, String, AssociationKind, IDeltaComputationOptions)
instead. |
void |
setAssociation(String association) |
void |
setAssociationKind(AssociationKind associationKind) |
String |
toString() |
void |
toString(StringBuffer buffer,
String indentation) |
public static final ModelObjectDelta newDelta(IModelObject object, IModelObject refObject, IDeltaComputationOptions options)
public static final ModelObjectDelta newEmptyDelta(IModelObject object, IModelObject refObject)
public static final void createChildDeltas(ModelObjectDelta delta, IModelObject original, IModelObject refObject, String association, IDeltaComputationOptions options)
public static final void createAssociatedChildDeltas(ModelObjectDelta delta, IModelObject original, IModelObject refObject, String association, IDeltaComputationOptions options)
public static final void createChildDeltas(ModelObjectDelta delta, List<? extends IModelObject> originals, List<? extends IModelObject> refObjects, String association, IDeltaComputationOptions options)
public static final void createAssociatedChildDeltas(ModelObjectDelta delta, List<? extends IModelObject> originals, List<? extends IModelObject> refObjects, String association, IDeltaComputationOptions options)
@Deprecated public static final ModelObjectDelta newAddDelta(IModelObject addedObject, String association, IDeltaComputationOptions options)
newAddDelta(IModelObject, String, AssociationKind, IDeltaComputationOptions)
instead.public static final ModelObjectDelta newAddDelta(IModelObject addedObject, String association, AssociationKind associationKind, IDeltaComputationOptions options)
@Deprecated public static final ModelObjectDelta newRemoveDelta(IModelObject removedObject, String association, IDeltaComputationOptions options)
newRemoveDelta(IModelObject, String, AssociationKind, IDeltaComputationOptions)
instead.public static final ModelObjectDelta newRemoveDelta(IModelObject removedObject, String association, AssociationKind associationKind, IDeltaComputationOptions options)
@Deprecated public static final ModelObjectDelta newDifferentObjectAtPositionChangedDelta(IModelObject original, IModelObject refObject, String association)
newDifferentObjectAtPositionChangedDelta(IModelObject, IModelObject, String, AssociationKind)
instead.public static final ModelObjectDelta newDifferentObjectAtPositionChangedDelta(IModelObject original, IModelObject refObject, String association, AssociationKind associationKind)
public static final ModelObjectDelta newChangeDelta(IModelObject original, IModelObject refObject, int kindOfChange)
public void addChildDelta(IModelObjectDelta childDelta)
Note this method ignores the childDelta if it is null or empty!!!
public IModelObject getOriginalObject()
IModelObjectDeltanull.getOriginalObject in interface IModelObjectDeltapublic IModelObject getReferenceObject()
IModelObjectDelta
If this is a delta for a a child that was removed from the orginial model object, the method
returns null.
getReferenceObject in interface IModelObjectDeltapublic int getKind()
IModelObjectDeltagetKind in interface IModelObjectDeltaIModelObjectDelta.EMPTY,
IModelObjectDelta.ADDED,
IModelObjectDelta.REMOVED,
IModelObjectDelta.MOVED,
IModelObjectDelta.DIFFERENT_OBJECT_AT_POSITION,
IModelObjectDelta.CHANGEDpublic int getKindOfChange()
IModelObjectDeltaIModelObjectDelta.CHANGED, this method returns the kind of changed defined by the
constant listed below. Not that the kind of changes are not mututally excluded, so the
returned kinds are bit masked. The method returns 0, if the delta's kind is not
IModelObjectDelta.CHANGED.getKindOfChange in interface IModelObjectDeltaIModelObjectDelta.PROPERTY_CHANGED,
IModelObjectDelta.STRUCTURE_CHANGED,
IModelObjectDelta.CHILD_CHANGEDpublic String getAssociation()
IModelObjectDeltanull for the root of the delta.getAssociation in interface IModelObjectDeltapublic void setAssociation(String association)
public AssociationKind getAssociationKind()
IModelObjectDeltagetAssociationKind in interface IModelObjectDeltaAssociationKind or null if this is the rootpublic void setAssociationKind(AssociationKind associationKind)
public void checkPropertyChange(String property, Object value1, Object value2, IDeltaComputationOptions options)
public void checkPropertyChange(String property, int value1, int value2, IDeltaComputationOptions options)
public void checkPropertyChange(String property, boolean value1, boolean value2, IDeltaComputationOptions options)
public void checkPropertyChange(String property, double value1, double value2, IDeltaComputationOptions options)
public void checkPropertyChange(String property, float value1, float value2, IDeltaComputationOptions options)
public void checkPropertyChange(String property, char value1, char value2, IDeltaComputationOptions options)
public void markPropertyChanged(String property)
public boolean isClassChanged()
IModelObjectDeltatrue if the model object's Java class has "changed". (Technically its of
course just an instance of another class). Returns false otherwise.isClassChanged in interface IModelObjectDeltapublic boolean isPropertyChanged()
IModelObjectDeltatrue if at least one the model object's properties has changed,
otherwise false.isPropertyChanged in interface IModelObjectDeltapublic List<String> getChangedProperties()
IModelObjectDelta
The order of properties in the list corresponds to the order defined in the model type. Properties not manually defined in the model type, such as
the product component, are placed
before manually defined attributes.
getChangedProperties in interface IModelObjectDeltapublic boolean isPropertyChanged(String propertyName)
IModelObjectDeltatrue if the model object contains a different value for the given
property than the reference model object. Returns false otherwise. Returns
false if propertyName is null.isPropertyChanged in interface IModelObjectDeltapublic void markMoved()
public boolean isMoved()
IModelObjectDeltatrue if this model object has changed its position in the ordered
association. This type of delta is only returned if the computation method is
IDeltaComputationOptions.ComputationMethod.BY_OBJECT.isMoved in interface IModelObjectDeltapublic boolean isDifferentObjectAtPosition()
IModelObjectDeltatrue if a different model object is at a position, otherwise
false. This type of delta is only returned if the computation method is
IDeltaComputationOptions.ComputationMethod.BY_POSITION.isDifferentObjectAtPosition in interface IModelObjectDeltapublic boolean isAdded()
IModelObjectDeltatrue if this model object has been added to its parent,
false otherwise.isAdded in interface IModelObjectDeltapublic boolean isChanged()
IModelObjectDeltatrue if this model object has been changed.isChanged in interface IModelObjectDeltapublic boolean isChildChanged()
IModelObjectDeltatrue if at least one model object's children has been changed.isChildChanged in interface IModelObjectDeltapublic boolean isEmpty()
IModelObjectDeltatrue if the delta is empty, the two objects are the same, otherwise
false.isEmpty in interface IModelObjectDeltapublic boolean isRemoved()
IModelObjectDeltatrue if this model object has been removed from its parent,
false otherwise.isRemoved in interface IModelObjectDeltapublic boolean isStructureChanged()
IModelObjectDeltatrue if this model object's structure has changed. That means either a
child has been added or removed or a child has been been moved.isStructureChanged in interface IModelObjectDeltapublic List<IModelObjectDelta> getChildDeltas()
IModelObjectDeltagetChildDeltas in interface IModelObjectDeltapublic List<IModelObjectDelta> getChildDeltas(int kind)
IModelObjectDeltaIModelObjectDelta kind
constants. Returns an empty array if there are no affected children.getChildDeltas in interface IModelObjectDeltapublic void accept(IModelObjectDeltaVisitor visitor)
IModelObjectDelta
The visitor's visit method is called. If the visitor returns true,
the delta's children are also visited.
accept in interface IModelObjectDeltavisitor - the visitorIModelObjectDeltaVisitor.visit(IModelObjectDelta)public void toString(StringBuffer buffer, String indentation)
Copyright © 2020. All rights reserved.