java.lang.Object
org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Differences
Direct Known Subclasses:
ClassificationDifferences, EntitySummaryDifferences, InstancePropertiesDifferences, RelationshipDifferences

public abstract class Differences extends Object
General class for capturing differences. Captures the following areas:
  • OnlyOnLeft - values that only appear on the 'left' object (the one from which differences were checked)
  • OnlyOnRight - values that only appear on the 'right' object (the one passed as an argument when differences were calculated).
  • Names - the names of the things that differ, including those from OnlyOnLeft, OnlyOnRight and where the thing has a value on both sides but that value is different
Every difference captures both the left-side value and the right-side value (except where it is OnlyOnLeft or OnlyOnRight, in which case the other side's value will always be null).
  • Field Details

    • differing

      protected Map<String,org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Differences.ValuePair> differing
    • matching

      protected Map<String,Object> matching
    • onlyOnLeft

      protected Map<String,Object> onlyOnLeft
    • onlyOnRight

      protected Map<String,Object> onlyOnRight
  • Constructor Details

    • Differences

      public Differences()
      Construct a new set of differences.
  • Method Details

    • hasDifferences

      public boolean hasDifferences()
      Returns true if the two have any differences (are not equal), otherwise false.
      Returns:
      boolean
    • getNames

      public Set<String> getNames()
      Returns the set of names of the things that differ.
      Returns:
      Set<String>
    • isDifferent

      public boolean isDifferent(String name)
      Returns true if the value mapped to the provided name differs, otherwise false if it is the same in both.
      Parameters:
      name - the name of the thing to check
      Returns:
      boolean
    • getLeftValue

      public Object getLeftValue(String name)
      Returns the value of the thing with the provided name from the first object used to create this diff.
      Parameters:
      name - the name of the thing for which to retrieve the value
      Returns:
      Object
    • getRightValue

      public Object getRightValue(String name)
      Returns the value of the thing with the provided name from the second object used to create this diff.
      Parameters:
      name - the name of the thing for which to retrieve the value
      Returns:
      Object
    • getOnlyOnLeft

      public Map<String,Object> getOnlyOnLeft()
      Returns a mapping of things (by name) that only appear on the first object used to create this diff.
      Returns:
      Map<String, Object>
    • getOnlyOnRight

      public Map<String,Object> getOnlyOnRight()
      Returns a mapping of things (by name) that only appear on the second object used to create this diff.
      Returns:
      Map<String, Object>
    • check

      public void check(String name, Object left, Object right)
      Determine if there is a difference between the provided values, and capture either that difference or the similarity.
      Parameters:
      name - the property name that differs
      left - the value in the first instance
      right - the value in the second instance
    • addOnlyOnOneSide

      public void addOnlyOnOneSide(Differences.SidePresent side, String name, Object value)
      Add the provided name as only existing on one side.
      Parameters:
      side - the side on which the value exists
      name - the name of the thing that points to the value
      value - the value
    • addMatching

      protected void addMatching(String name, Object value)
      Add the provided name as a matching thing.
      Parameters:
      name - the name of the matching thing
      value - the value that is the same across both
    • addDiffering

      protected void addDiffering(String name, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Differences.ValuePair valuePair)
      Add the provided name as a differing thing.
      Parameters:
      name - the name of the differing thing
      valuePair - the value for each