org.oddjob.beancmpr.comparers
Class EqualityComparison<T>

java.lang.Object
  extended by org.oddjob.beancmpr.comparers.EqualityComparison<T>
All Implemented Interfaces:
Comparison<T>

public class EqualityComparison<T>
extends Object
implements Comparison<T>

A simple comparison where the result of a compare was that two values are not equal.

Author:
rob

Constructor Summary
EqualityComparison(T x, T y)
           
 
Method Summary
 int getResult()
          The result of the comparison.
 String getSummaryRegardless()
           
 String getSummaryText()
          Provide a brief summary of the comparison.
 T getX()
          Get the x of the comparison.
 T getY()
          Get the y of the comparison.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EqualityComparison

public EqualityComparison(T x,
                          T y)
Method Detail

getX

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

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

getY

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

Specified by:
getY in interface Comparison<T>
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<T>
Returns:
true/false.

getSummaryRegardless

public String getSummaryRegardless()

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<T>
Returns:
A short text description of the comparison.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.