org.oddjob.beancmpr.matchables
Class MatchableComparision

java.lang.Object
  extended by org.oddjob.beancmpr.matchables.MatchableComparision
All Implemented Interfaces:
Comparison<Matchable>, MultiValueComparison<Matchable>

public class MatchableComparision
extends Object
implements MultiValueComparison<Matchable>

The result of comparing to Matchables.

Author:
rob

Constructor Summary
MatchableComparision(Matchable x, Matchable y, Iterable<? extends Comparison<?>> comparisons)
           
 
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.
 Matchable getX()
          Get the x of the comparison.
 Matchable 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

MatchableComparision

public MatchableComparision(Matchable x,
                            Matchable y,
                            Iterable<? extends Comparison<?>> comparisons)
Method Detail

getX

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

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

getY

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

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

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<Matchable>
Returns:

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

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.