Top Description Fields Constructors Methods
org.assertj.core.api.recursive.comparison

public Class DefaultRecursiveComparisonIntrospectionStrategy

extends Object
implements RecursiveComparisonIntrospectionStrategy
Class Inheritance
All Implemented Interfaces
org.assertj.core.api.recursive.comparison.RecursiveComparisonIntrospectionStrategy
Static Imports
org.assertj.core.util.introspection.PropertyOrFieldSupport.COMPARISON

Introspects all fields (including inherited ones) and get their value according to PropertyOrFieldSupport#getSimpleValue(String, Object).

There is a bit of discrepancy in this strategy as it looks for fields to compare but gets the value in this order: property first, then field and finally tries as map value if the instance is a map.

Field Summary

Modifier and TypeField and Description
private final Map<Class<?>, Set<String>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
getChildNodeValue(String
the child node identifier
childNodeName
,
Object
the object to read the child node from
instance
)

Implements org.assertj.core.api.recursive.comparison.RecursiveComparisonIntrospectionStrategy.getChildNodeValue.

Returns the value of the given object child node, the child node being identified by the childNodeName parameter.
public Set<String>
getChildrenNodeNamesOf(Object
the object to get the child nodes from
node
)

Implements org.assertj.core.api.recursive.comparison.RecursiveComparisonIntrospectionStrategy.getChildrenNodeNamesOf.

Returns the names of the children nodes of the given object that will be used in the recursive comparison.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fieldNamesPerClassback to summary
private final Map<Class<?>, Set<String>> fieldNamesPerClass

Constructor Detail

DefaultRecursiveComparisonIntrospectionStrategyback to summary
public DefaultRecursiveComparisonIntrospectionStrategy()

Method Detail

getChildNodeValueback to summary
public Object getChildNodeValue(String childNodeName, Object instance)

Implements org.assertj.core.api.recursive.comparison.RecursiveComparisonIntrospectionStrategy.getChildNodeValue.

Doc from org.assertj.core.api.recursive.comparison.RecursiveComparisonIntrospectionStrategy.getChildNodeValue.

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:String

the child node identifier

instance:Object

the object to read the child node from

Returns:Object

the object child node value

Annotations
@Override
getChildrenNodeNamesOfback to summary
public Set<String> getChildrenNodeNamesOf(Object node)

Implements org.assertj.core.api.recursive.comparison.RecursiveComparisonIntrospectionStrategy.getChildrenNodeNamesOf.

Doc from org.assertj.core.api.recursive.comparison.RecursiveComparisonIntrospectionStrategy.getChildrenNodeNamesOf.

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:Object

the object to get the child nodes from

Returns:Set<String>

the names of the children nodes of the given object

Annotations
@Override