Class ChangeCalculator

java.lang.Object
cz.cvut.kbss.jopa.sessions.change.ChangeCalculator

public class ChangeCalculator extends Object
Calculates changes made on objects by comparing a clone with its registered original.
  • Constructor Details

  • Method Details

    • hasChanges

      public boolean hasChanges(Object original, Object clone)
      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

      public boolean calculateChanges(ObjectChangeSet changeSet)
      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 - If changeSet is null