Class Differences
java.lang.Object
org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Differences
- Direct Known Subclasses:
ClassificationDifferences
,EntitySummaryDifferences
,InstancePropertiesDifferences
,RelationshipDifferences
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
Modifier and TypeClassDescriptionstatic enum
Defines the valid values for the differences.static class
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addDiffering
(String name, Differences.ValuePair valuePair) Add the provided name as a differing thing.protected void
addMatching
(String name, Object value) Add the provided name as a matching thing.void
addOnlyOnOneSide
(Differences.SidePresent side, String name, Object value) Add the provided name as only existing on one side.void
Determine if there is a difference between the provided values, and capture either that difference or the similarity.getLeftValue
(String name) Returns the value of the thing with the provided name from the first object used to create this diff.getNames()
Returns the set of names of the things that differ.Returns a mapping of things (by name) that only appear on the first object used to create this diff.Returns a mapping of things (by name) that only appear on the second object used to create this diff.getRightValue
(String name) Returns the value of the thing with the provided name from the second object used to create this diff.boolean
Returns true if the two have any differences (are not equal), otherwise false.boolean
isDifferent
(String name) Returns true if the value mapped to the provided name differs, otherwise false if it is the same in both.
-
Field Details
-
differing
-
matching
-
onlyOnLeft
-
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
Returns the set of names of the things that differ.- Returns:
Set<String>
-
isDifferent
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
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
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
Returns a mapping of things (by name) that only appear on the first object used to create this diff.- Returns:
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
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
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
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
Add the provided name as a differing thing.- Parameters:
name
- the name of the differing thingvaluePair
- the value for each
-