org.unitils.reflectionassert.util
Class InnerDifferenceFinder.InnerDifferenceVisitor

java.lang.Object
  extended by org.unitils.reflectionassert.util.InnerDifferenceFinder.InnerDifferenceVisitor
All Implemented Interfaces:
DifferenceVisitor<Difference,String>
Enclosing class:
InnerDifferenceFinder

protected static class InnerDifferenceFinder.InnerDifferenceVisitor
extends Object
implements DifferenceVisitor<Difference,String>

The visitor for visiting the difference tree.


Field Summary
protected  ObjectFormatter objectFormatter
          Formatter for object values.
 
Constructor Summary
protected InnerDifferenceFinder.InnerDifferenceVisitor()
           
 
Method Summary
 Difference visit(ClassDifference classDifference, String argument)
          Visits a class difference.
 Difference visit(CollectionDifference collectionDifference, String indexString)
          Returns the difference at the field with the given index.
 Difference visit(Difference difference, String key)
          Returns null, there are no inner differences for a simple difference.
 Difference visit(MapDifference mapDifference, String keyString)
          Returns the difference at the given key.
 Difference visit(ObjectDifference objectDifference, String fieldName)
          Returns the difference at the field with the given name.
 Difference visit(UnorderedCollectionDifference unorderedCollectionDifference, String indexString)
          Returns the best matching difference at the field with the given index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objectFormatter

protected ObjectFormatter objectFormatter
Formatter for object values.

Constructor Detail

InnerDifferenceFinder.InnerDifferenceVisitor

protected InnerDifferenceFinder.InnerDifferenceVisitor()
Method Detail

visit

public Difference visit(Difference difference,
                        String key)
Returns null, there are no inner differences for a simple difference.

Specified by:
visit in interface DifferenceVisitor<Difference,String>
Parameters:
difference - The difference, not null
key - The key
Returns:
null

visit

public Difference visit(ObjectDifference objectDifference,
                        String fieldName)
Returns the difference at the field with the given name.

Specified by:
visit in interface DifferenceVisitor<Difference,String>
Parameters:
objectDifference - The difference, not null
fieldName - The field name, not null
Returns:
The difference, null if there is no difference

visit

public Difference visit(ClassDifference classDifference,
                        String argument)
Description copied from interface: DifferenceVisitor
Visits a class difference.

Specified by:
visit in interface DifferenceVisitor<Difference,String>
Parameters:
classDifference - The difference
argument - An optional argument, null if NA
Returns:
The result

visit

public Difference visit(MapDifference mapDifference,
                        String keyString)
Returns the difference at the given key. The string represenation (using the object formatter) of the keys in the map are compared with the given key string.

Specified by:
visit in interface DifferenceVisitor<Difference,String>
Parameters:
mapDifference - The difference, not null
keyString - The key as a string, not null
Returns:
The difference, null if there is no difference

visit

public Difference visit(CollectionDifference collectionDifference,
                        String indexString)
Returns the difference at the field with the given index.

Specified by:
visit in interface DifferenceVisitor<Difference,String>
Parameters:
collectionDifference - The difference, not null
indexString - The index number as a string, not null
Returns:
The difference, null if there is no difference

visit

public Difference visit(UnorderedCollectionDifference unorderedCollectionDifference,
                        String indexString)
Returns the best matching difference at the field with the given index.

Specified by:
visit in interface DifferenceVisitor<Difference,String>
Parameters:
unorderedCollectionDifference - The difference, not null
indexString - The index number as a string, not null
Returns:
The difference, null if there is no difference


Copyright © 2011. All Rights Reserved.