Interface RecursiveComparisonIntrospectionStrategy
-
- All Known Implementing Classes:
ComparingFields
,ComparingNormalizedFields
,ComparingProperties
,ComparingSnakeOrCamelCaseFields
,DefaultRecursiveComparisonIntrospectionStrategy
public interface RecursiveComparisonIntrospectionStrategy
Defines how objects are introspected in the recursive comparison, the main operations it specifies are:- how to traverse the graph of nodes to compare
- how to get a child node value
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.Object
getChildNodeValue(java.lang.String childNodeName, java.lang.Object object)
Returns the value of the given object child node, the child node being identified by the childNodeName parameter.java.util.Set<java.lang.String>
getChildrenNodeNamesOf(java.lang.Object node)
Returns the names of the children nodes of the given object that will be used in the recursive comparison.default java.lang.String
getDescription()
Returns a human-readable description of the strategy to be used in error messages.
-
-
-
Method Detail
-
getChildrenNodeNamesOf
java.util.Set<java.lang.String> getChildrenNodeNamesOf(java.lang.Object node)
Returns the names of the children nodes of the given object that will be used in the recursive comparison.A typical implementation could look at the object fields or properties.
- Parameters:
node
- the object to get the child nodes from- Returns:
- the names of the children nodes of the given object
-
getChildNodeValue
java.lang.Object getChildNodeValue(java.lang.String childNodeName, java.lang.Object object)
Returns the value of the given object child node, the child node being identified by the childNodeName parameter.It's the implementor choice how to resolve the child node value, a typical implementation consists of considering childNodeName to be a field name and then use introspection to read the field value, but if the object is a Map the implementation could consider the child node name to be a key of the map.
- Parameters:
childNodeName
- the child node identifierobject
- the object to read the child node from- Returns:
- the object child node value
-
getDescription
default java.lang.String getDescription()
Returns a human-readable description of the strategy to be used in error messages.The default implementation returns
this.getClass().getSimpleName()
.- Returns:
- a description of the strategy
-
-