Class ChangeCalculator
java.lang.Object
cz.cvut.kbss.jopa.sessions.change.ChangeCalculator
Calculates changes made on objects by comparing a clone with its registered original.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
calculateChanges
(ObjectChangeSet changeSet) Calculates the changes that happened to the clone object.boolean
hasChanges
(Object original, Object clone) Checks whether there are any changes to the clone.
-
Constructor Details
-
ChangeCalculator
-
-
Method Details
-
hasChanges
Checks whether there are any changes to the clone.It does an object value comparison, i.e. it compares each value of the clone against the original value and returns true if a change is found.
- Parameters:
original
- The original object.clone
- The clone, whose changes we are looking for.- Returns:
- True if there is a change (at least one) or false, if the values are identical.
-
calculateChanges
Calculates the changes that happened to the clone object.The changes are written into the
Change
passed in as argument.- Parameters:
changeSet
- Contains references to the original and clone objects. Into this change set the changes should be propagated- Returns:
true
if there were any changes,false
otherwise- Throws:
NullPointerException
- IfchangeSet
isnull
-