org.oddjob.beancmpr.beans
Class BeanComparer

java.lang.Object
  extended by org.oddjob.beancmpr.beans.BeanComparer
All Implemented Interfaces:
Comparer<Object>

public class BeanComparer
extends Object
implements Comparer<Object>

A comparer that is able to compare two beans.

Author:
rob

Constructor Summary
BeanComparer(String[] valueProperties, org.oddjob.arooa.reflect.PropertyAccessor accessor, BeanComparerProvider comparerProvider)
           
 
Method Summary
 BeanComparison compare(Object x, Object y)
          Compare two things.
 Class<Object> getType()
          The type of the things.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanComparer

public BeanComparer(String[] valueProperties,
                    org.oddjob.arooa.reflect.PropertyAccessor accessor,
                    BeanComparerProvider comparerProvider)
Method Detail

compare

public BeanComparison 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<Object> 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.