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

java.lang.Object
  extended by org.oddjob.beancmpr.comparers.IterableComparer<T>
All Implemented Interfaces:
Comparer<Iterable<? extends T>>, HierarchicalComparer

public class IterableComparer<T>
extends Object
implements HierarchicalComparer, Comparer<Iterable<? extends T>>

Compares to Iterables.

Author:
rob

Constructor Summary
IterableComparer()
           
 
Method Summary
 IterableComparison<T> compare(Iterable<? extends T> x, Iterable<? extends T> y)
          Compare two things.
 Class<?> getType()
          The type of the things.
 void injectComparers(ComparersByType comparers)
          Used by owner of comparers to inject the master comparer into HierarchicalComparers.
 void setComparersByType(ComparersByType comparersByType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IterableComparer

public IterableComparer()
Method Detail

setComparersByType

public void setComparersByType(ComparersByType comparersByType)

injectComparers

public void injectComparers(ComparersByType comparers)
Description copied from interface: HierarchicalComparer
Used by owner of comparers to inject the master comparer into HierarchicalComparers.

Specified by:
injectComparers in interface HierarchicalComparer
Parameters:
comparers - The master comparers.

compare

public IterableComparison<T> compare(Iterable<? extends T> x,
                                     Iterable<? extends T> y)
Description copied from interface: Comparer
Compare two things.

Specified by:
compare in interface Comparer<Iterable<? extends T>>
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

public Class<?> getType()
Description copied from interface: Comparer
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.

Specified by:
getType in interface Comparer<Iterable<? extends T>>
Returns:
The type. Must not be null.


Copyright © 2013. All Rights Reserved.