Interface IModelObjectDelta
- All Known Implementing Classes:
ModelObjectDelta
- Author:
- Jan Ortmann
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDelta kind constant indicating that the model object has been added to it's parent.static final intDelta kind constant indicating that the model object has changed somehow.static final intDelta change type constant indicating that at least one child (that has neither been added or removed or just moved) has changed.static final intDelta change type constant indicating that the class of the object has changed.static final intDelta kind constant indicating that a different model object is now at a given position.static final intConstant indicating that the delta is empty, no difference exists between the two objects.static final intDelta kind constant indicating that the model object has been moved, meaning it's position in the ordered list of objects has been changed.static final intDelta change type constant indicating that at least one of the object's properties has changed.static final intDelta kind constant indicating that the model object has been removed from it's parent.static final intDelta change type constant indicating that the object's structure has changed, that means either a child has been added, removed or changed its position (if the computation method isIDeltaComputationOptions.ComputationMethod.BY_OBJECTor a different object is now at a given position (if the computation method isIDeltaComputationOptions.ComputationMethod.BY_OBJECT. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(IModelObjectDeltaVisitor visitor) Accepts the given visitor.The name of the association in which the object has been added, removed or changed.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.Returns the properties that have a different value in the model object and the reference model object.Returns deltas for all children of the model object which were added, removed, or changed.getChildDeltas(int kind) Returns deltas for all children of this model object whose kind is included in the given mask.intgetKind()Returns the kind of change.intIf delta's kind isCHANGED, this method returns the kind of changed defined by the constant listed below.The model object this delta is computed for.The model object that is taken as a reference to which the orginal model object is compared to.booleanisAdded()Returnstrueif this model object has been added to its parent,falseotherwise.booleanReturnstrueif this model object has been changed.booleanReturnstrueif at least one model object's children has been changed.booleanReturnstrueif the model object's Java class has "changed".booleanReturnstrueif a different model object is at a position, otherwisefalse.booleanisEmpty()Returnstrueif the delta is empty, the two objects are the same, otherwisefalse.booleanisMoved()Returnstrueif this model object has changed its position in the ordered association.booleanReturnstrueif at least one the model object's properties has changed, otherwisefalse.booleanisPropertyChanged(String propertyName) Returnstrueif the model object contains a different value for the given property than the reference model object.booleanReturnstrueif this model object has been removed from its parent,falseotherwise.booleanReturnstrueif this model object's structure has changed.
-
Field Details
-
EMPTY
static final int EMPTYConstant indicating that the delta is empty, no difference exists between the two objects.If the object is a root object, this means that all properties are equal, no children have been removed, added or have changed their position.
If this object is a dependent object (it belongs to a parent), this means that all properties are equal and this object has neither been added to or removed from its parent nor has the position of the object changed.
- See Also:
-
ADDED
static final int ADDEDDelta kind constant indicating that the model object has been added to it's parent.- See Also:
-
REMOVED
static final int REMOVEDDelta kind constant indicating that the model object has been removed from it's parent.- See Also:
-
MOVED
static final int MOVEDDelta kind constant indicating that the model object has been moved, meaning it's position in the ordered list of objects has been changed. This type of delta is only returned if the computation method isIDeltaComputationOptions.ComputationMethod.BY_OBJECT.Note that an object can be moved and changed! In this case getKind() returns
MOVED & CHANGED.- See Also:
-
DIFFERENT_OBJECT_AT_POSITION
static final int DIFFERENT_OBJECT_AT_POSITIONDelta kind constant indicating that a different model object is now at a given position. This type of delta is only returned if the computation method isIDeltaComputationOptions.ComputationMethod.BY_POSITION.- See Also:
-
CHANGED
static final int CHANGEDDelta kind constant indicating that the model object has changed somehow. If the object has changed, the type of change is further specified with the following constants. Note that these constants are bit masks as more than one type of change can occur.Note that an object can be moved and changed! In this case getKind() returns
MOVED & CHANGED. -
STRUCTURE_CHANGED
static final int STRUCTURE_CHANGEDDelta change type constant indicating that the object's structure has changed, that means either a child has been added, removed or changed its position (if the computation method isIDeltaComputationOptions.ComputationMethod.BY_OBJECTor a different object is now at a given position (if the computation method isIDeltaComputationOptions.ComputationMethod.BY_OBJECT.- See Also:
-
PROPERTY_CHANGED
static final int PROPERTY_CHANGEDDelta change type constant indicating that at least one of the object's properties has changed.- See Also:
-
CHILD_CHANGED
static final int CHILD_CHANGEDDelta change type constant indicating that at least one child (that has neither been added or removed or just moved) has changed. Either one of the child's properties has changed or it's structure (or both).- See Also:
-
CLASS_CHANGED
static final int CLASS_CHANGEDDelta change type constant indicating that the class of the object has changed.- See Also:
-
-
Method Details
-
getOriginalObject
IModelObject getOriginalObject()The model object this delta is computed for. If this is a delta for a a child that was added to the new object, the method returnsnull. -
getReferenceObject
IModelObject getReferenceObject()The model object that is taken as a reference to which the orginal model object is compared to.If this is a delta for a a child that was removed from the orginial model object, the method returns
null. -
getKind
int getKind()Returns the kind of change. Note that an object can be moved and changed! To allow this type of information to be returned, a bit mask is used! -
getKindOfChange
int getKindOfChange()If delta's kind isCHANGED, 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 notCHANGED.- See Also:
-
isEmpty
boolean isEmpty()Returnstrueif the delta is empty, the two objects are the same, otherwisefalse. -
isAdded
boolean isAdded()Returnstrueif this model object has been added to its parent,falseotherwise. -
isRemoved
boolean isRemoved()Returnstrueif this model object has been removed from its parent,falseotherwise. -
isMoved
boolean isMoved()Returnstrueif this model object has changed its position in the ordered association. This type of delta is only returned if the computation method isIDeltaComputationOptions.ComputationMethod.BY_OBJECT. -
isDifferentObjectAtPosition
boolean isDifferentObjectAtPosition()Returnstrueif a different model object is at a position, otherwisefalse. This type of delta is only returned if the computation method isIDeltaComputationOptions.ComputationMethod.BY_POSITION. -
isChanged
boolean isChanged()Returnstrueif this model object has been changed. -
isStructureChanged
boolean isStructureChanged()Returnstrueif this model object's structure has changed. That means either a child has been added or removed or a child has been been moved. -
isClassChanged
boolean isClassChanged()Returnstrueif the model object's Java class has "changed". (Technically its of course just an instance of another class). Returnsfalseotherwise. -
isPropertyChanged
boolean isPropertyChanged()Returnstrueif at least one the model object's properties has changed, otherwisefalse. -
isChildChanged
boolean isChildChanged()Returnstrueif at least one model object's children has been changed. -
getAssociation
String getAssociation()The name of the association in which the object has been added, removed or changed. The association name is alwaysnullfor the root of the delta. -
getAssociationKind
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.- Returns:
- the
AssociationKindornullif this is the root
-
getChangedProperties
Returns the properties that have a different value in the model object and the reference model object. Returns an empty list if no such property exists.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 theproduct component, are placed before manually defined attributes. -
isPropertyChanged
Returnstrueif the model object contains a different value for the given property than the reference model object. Returnsfalseotherwise. Returnsfalseif propertyName isnull. -
getChildDeltas
List<IModelObjectDelta> getChildDeltas()Returns deltas for all children of the model object which were added, removed, or changed. Returns an empty array if there are no affected children. -
getChildDeltas
Returns deltas for all children of this model object whose kind is included in the given mask. Kind masks are formed by the bitwise or ofIModelObjectDeltakind constants. Returns an empty array if there are no affected children. -
accept
Accepts the given visitor.The visitor's
visitmethod is called. If the visitor returnstrue, the delta's children are also visited.- Parameters:
visitor- the visitor- Throws:
NullPointerException- if visitor isnull.- See Also:
-