org.oddjob.beancmpr.beans
Class BeanComparison

java.lang.Object
  extended by org.oddjob.beancmpr.beans.BeanComparison
All Implemented Interfaces:
Comparison<Object>, MultiValueComparison<Object>

public class BeanComparison
extends Object
implements MultiValueComparison<Object>

The result of comparing two beans.

Author:
rob

Constructor Summary
BeanComparison(Object x, Object y, MultiValueComparison<?> delegate)
           
 
Method Summary
 int getResult()
          The result of the comparison.
 String getSummaryText()
          Provide a brief summary of the comparison.
 Iterable<Comparison<?>> getValueComparisons()
          Provides an Iterable of the individual Comparisons between the values of two Matchables.
 Object getX()
          Get the x of the comparison.
 Object getY()
          Get the y of the comparison.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanComparison

public BeanComparison(Object x,
                      Object y,
                      MultiValueComparison<?> delegate)
Method Detail

getX

public Object getX()
Description copied from interface: Comparison
Get the x of the comparison.

Specified by:
getX in interface Comparison<Object>
Returns:
The x. Will not be null.

getY

public Object getY()
Description copied from interface: Comparison
Get the y of the comparison.

Specified by:
getY in interface Comparison<Object>
Returns:
The y. Will not be null.

getResult

public int getResult()
Description copied from interface: Comparison
The result of the comparison. 0 they are equal. -1 when x < y and 1 when x > y

Specified by:
getResult in interface Comparison<Object>
Returns:
true/false.

getSummaryText

public String getSummaryText()
Description copied from interface: Comparison
Provide a brief summary of the comparison.

If the comparison is equal then this should be the text representation of either of the original values. If the comparison is not equal then this should be a short description of the difference, e.g. 'Fred <> Jane'.

As a rule of thumb summary should be suitable for displaying in the column of a report or the cell of a spreadsheet.

Specified by:
getSummaryText in interface Comparison<Object>
Returns:
A short text description of the comparison.

getValueComparisons

public Iterable<Comparison<?>> getValueComparisons()
Description copied from interface: MultiValueComparison
Provides an Iterable of the individual Comparisons between the values of two Matchables.

Specified by:
getValueComparisons in interface MultiValueComparison<Object>
Returns:


Copyright © 2013. All Rights Reserved.