org.unitils.reflectionassert.difference
Class Difference

java.lang.Object
  extended by org.unitils.reflectionassert.difference.Difference
Direct Known Subclasses:
ClassDifference, CollectionDifference, MapDifference, ObjectDifference, UnorderedCollectionDifference

public class Difference
extends Object

A class for holding the difference between two objects.

Author:
Tim Ducheyne, Filip Neven

Constructor Summary
Difference(String message, Object leftValue, Object rightValue)
          Creates a difference.
 
Method Summary
<T,A> T
accept(DifferenceVisitor<T,A> visitor, A argument)
          Double dispatch method.
 Object getLeftValue()
          Gets the left value.
 String getMessage()
          Gets the message indicating the kind of difference.
 Object getRightValue()
          Gets the right value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Difference

public Difference(String message,
                  Object leftValue,
                  Object rightValue)
Creates a difference.

Parameters:
message - a message describing the difference
leftValue - the left instance
rightValue - the right instance
Method Detail

getLeftValue

public Object getLeftValue()
Gets the left value.

Returns:
the value

getRightValue

public Object getRightValue()
Gets the right value.

Returns:
the value

getMessage

public String getMessage()
Gets the message indicating the kind of difference.

Returns:
the message

accept

public <T,A> T accept(DifferenceVisitor<T,A> visitor,
                      A argument)
Double dispatch method. Dispatches back to the given visitor.

All subclasses should copy this method in their own class body.

Parameters:
visitor - The visitor, not null
argument - An optional argument for the visitor, null if not applicable
Returns:
The result


Copyright © 2011. All Rights Reserved.