Class DeltaComputationOptionsByPosition
- java.lang.Object
-
- org.faktorips.runtime.DeltaComputationOptionsByPosition
-
- All Implemented Interfaces:
IDeltaComputationOptions
public class DeltaComputationOptionsByPosition extends java.lang.Object implements IDeltaComputationOptions
Delta computation options that create child deltas per position and don't ignore any property.- Author:
- Jan Ortmann
- See Also:
IDeltaComputationOptions.ComputationMethod.BY_POSITION
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.faktorips.runtime.IDeltaComputationOptions
IDeltaComputationOptions.ComputationMethod
-
-
Constructor Summary
Constructors Constructor Description DeltaComputationOptionsByPosition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanareValuesEqual(java.lang.Class<?> modelClass, java.lang.String property, java.lang.Object value1, java.lang.Object value2)Compares two values for equality by the given model class and property, where either one or both values may benull.IDeltaComputationOptions.ComputationMethodgetMethod(java.lang.String association)Returns if the delta computation computes child deltas per position/index or per object.booleanignore(java.lang.Class<?> clazz, java.lang.String property)Returnsfalse.booleanignoreAssociations()Controls whetherassociationsshould be ignored when computing deltas.booleanisCreateSubtreeDelta()Controls whether delta objects for added or removed subtree elements should be created explicitly.booleanisSame(IModelObject object1, IModelObject object2)Returnstrueif the specified object references are identical.
-
-
-
Method Detail
-
getMethod
public IDeltaComputationOptions.ComputationMethod getMethod(java.lang.String association)
Description copied from interface:IDeltaComputationOptionsReturns if the delta computation computes child deltas per position/index or per object.1. Example for a 1-many association:
A contract version A has three coverages c0, c1, and c2. A second version B of the same contract has a new coverage cNew inserted between coverage c0 and c1. The coverages c0, c1,and c2 are unchanged except for their position.If this method returns
IDeltaComputationOptions.ComputationMethod.BY_POSITION, the following deltas are computed. position 0: version A:c0, version B:c0 ⇒ empty delta position 1: version A:c1, version B:cNew ⇒ changed position 2: version A:c2, version B:c1 ⇒ changed position 3: version A:none, version B:c2 ⇒ addedIf this method returns
IDeltaComputationOptions.ComputationMethod.BY_OBJECT, the following deltas are computed. c0: version A:position 0, version B:position 0 ⇒ empty delta c1: version A:position 1, version B:position 2 ⇒ moved c2: version A:position 2, version B:position 3 ⇒ moved cNew: version A:position none, version B:position 1 ⇒ added2. Example for a 1-many association:
Same scenario as above, but now c1 is removed and no coverage is added.If this method returns
IDeltaComputationOptions.ComputationMethod.BY_POSITION, the following deltas are computed. position 0: version A:c0, version B:c0 ⇒ empty delta position 1: version A:c1, version B:v2 ⇒ changed position 2: version A:c2, version B:none ⇒ removedIf this method returns
IDeltaComputationOptions.ComputationMethod.BY_OBJECT, the following deltas are computed. c0: version A:position 0, version B:position 0 ⇒ empty delta c1: version A:position 1, version B:position none ⇒ removed c2: version A:position 2, version B:position 1 ⇒ movedExample for a 1-1 association:
A contract version A has the insured person p0. A second contract version B has the insured person p1.If this method returns
IDeltaComputationOptions.ComputationMethod.BY_POSITION, the following delta is computed. position 0: changedIf this method returns
IDeltaComputationOptions.ComputationMethod.BY_OBJECT, the following deltas are computed. p1: removed p2: added- Specified by:
getMethodin interfaceIDeltaComputationOptions
-
isSame
public boolean isSame(IModelObject object1, IModelObject object2)
Returnstrueif the specified object references are identical.- Specified by:
isSamein interfaceIDeltaComputationOptions
-
ignore
public boolean ignore(java.lang.Class<?> clazz, java.lang.String property)Returnsfalse.- Specified by:
ignorein interfaceIDeltaComputationOptions- Parameters:
clazz- The class the property belongs to.property- The name of the property.
-
isCreateSubtreeDelta
public boolean isCreateSubtreeDelta()
Description copied from interface:IDeltaComputationOptionsControls whether delta objects for added or removed subtree elements should be created explicitly.This method returns
trueif a delta should be created for added or removed subtrees. If this method returnsfalsea delta is only created for the root of an added or removed subtree. For non-composition associations, this property is ignored because such associated objects are never processed recursively.The creation of delta elements for subtree nodes is based on reflection and may cause a performance issue if used in massive delta computation with many added or removed subtrees.
- Specified by:
isCreateSubtreeDeltain interfaceIDeltaComputationOptions- Returns:
trueif a delta should be created for every element of an added or removed subtree.
-
areValuesEqual
public boolean areValuesEqual(java.lang.Class<?> modelClass, java.lang.String property, java.lang.Object value1, java.lang.Object value2)Description copied from interface:IDeltaComputationOptionsCompares two values for equality by the given model class and property, where either one or both values may benull.- Specified by:
areValuesEqualin interfaceIDeltaComputationOptions- Parameters:
modelClass- The class the property belongs to.property- The name of the property.value1- The first value to comparevalue2- The second value to compare- Returns:
trueif the values are the same
-
ignoreAssociations
public boolean ignoreAssociations()
Description copied from interface:IDeltaComputationOptionsControls whetherassociationsshould be ignored when computing deltas. If set totrue, onlyparent-to-child relationswill be included.- Specified by:
ignoreAssociationsin interfaceIDeltaComputationOptions- Returns:
- whether
associationsshould be ignored.
-
-