Class Differences
- 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDifferences.SidePresent
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Differences.ValuePair>differingprotected Map<String,Object>matchingprotected Map<String,Object>onlyOnLeftprotected Map<String,Object>onlyOnRight
-
Constructor Summary
Constructors Constructor Description Differences()Construct a new set of differences.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddDiffering(String name, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Differences.ValuePair valuePair)Add the provided name as a differing thing.protected voidaddMatching(String name, Object value)Add the provided name as a matching thing.voidaddOnlyOnOneSide(Differences.SidePresent side, String name, Object value)Add the provided name as only existing on one side.voidcheck(String name, Object left, Object right)Determine if there is a difference between the provided values, and capture either that difference or the similarity.ObjectgetLeftValue(String name)Returns the value of the thing with the provided name from the first object used to create this diff.Set<String>getNames()Returns the set of names of the things that differ.Map<String,Object>getOnlyOnLeft()Returns a mapping of things (by name) that only appear on the first object used to create this diff.Map<String,Object>getOnlyOnRight()Returns a mapping of things (by name) that only appear on the second object used to create this diff.ObjectgetRightValue(String name)Returns the value of the thing with the provided name from the second object used to create this diff.booleanhasDifferences()Returns true if the two have any differences (are not equal), otherwise false.booleanisDifferent(String name)Returns true if the value mapped to the provided name differs, otherwise false if it is the same in both.
-
-
-
Method Detail
-
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 differsleft- the value in the first instanceright- 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 existsname- the name of the thing that points to the valuevalue- 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 thingvalue- 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 thingvaluePair- the value for each
-
-