org.oddjob.beancmpr.comparers
Class ArrayComparer

java.lang.Object
  extended by org.oddjob.beancmpr.comparers.ArrayComparer
All Implemented Interfaces:
Comparer<Object[]>, HierarchicalComparer

public class ArrayComparer
extends Object
implements HierarchicalComparer, Comparer<Object[]>

Compares to Arrays of Objects.

Author:
rob

Constructor Summary
ArrayComparer()
           
 
Method Summary
 Comparison<Object[]> compare(Object[] x, Object[] y)
          Compare two things.
 Class<?> getType()
          The type of the things.
 void injectComparers(ComparersByType comparersByType)
          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

ArrayComparer

public ArrayComparer()
Method Detail

setComparersByType

public void setComparersByType(ComparersByType comparersByType)

injectComparers

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

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

compare

public Comparison<Object[]> compare(Object[] x,
                                    Object[] y)
Description copied from interface: Comparer
Compare two things.

Specified by:
compare in interface Comparer<Object[]>
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<Object[]>
Returns:
The type. Must not be null.


Copyright © 2013. All Rights Reserved.