org.oddjob.beancmpr
Interface Comparer<T>

All Known Subinterfaces:
MatchableComparer
All Known Implementing Classes:
ArrayComparer, BeanComparer, DateComparer, DefaultMatchableComparer, EqualityComparer, IterableComparer, NumericComparer, OrderedMatchablesComparer

public interface Comparer<T>

Something that is able to compare two things of a type T.

Author:
Rob

Method Summary
 Comparison<T> compare(T x, T y)
          Compare two things.
 Class<?> getType()
          The type of the things.
 

Method Detail

compare

Comparison<T> compare(T x,
                      T y)
Compare two things.

Parameters:
x - One thing.
y - The other thing.
Returns:
A Comparison. The may be null if either or both of x and y is null.

getType

Class<?> getType()
The type of the things.

Note that we would have liked the return type to be Class<T> but we could not then have had a Comparer<Iterable<MatchableGroup>> because it's not possible to return a type of Class<Iterable<MatchableGroup>> in Java. If there is a solution to this then please let us know.

Returns:
The type. Must not be null.


Copyright © 2013. All Rights Reserved.