|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.unitils.reflectionassert.comparator.impl.ObjectComparator
public class ObjectComparator
Comparator for objects. This will compare all corresponding field values.
Constructor Summary | |
---|---|
ObjectComparator()
|
Method Summary | |
---|---|
boolean |
canCompare(Object left,
Object right)
Returns true if both objects are not null |
Difference |
compare(Object left,
Object right,
boolean onlyFirstDifference,
ReflectionComparator reflectionComparator)
Compares the given objects by iterating over the fields and comparing the corresponding values. |
protected void |
compareFields(Object left,
Object right,
Class<?> clazz,
ObjectDifference difference,
boolean onlyFirstDifference,
ReflectionComparator reflectionComparator)
Compares the values of all fields in the given objects by use of reflection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectComparator()
Method Detail |
---|
public boolean canCompare(Object left, Object right)
canCompare
in interface Comparator
left
- The left objectright
- The right object
public Difference compare(Object left, Object right, boolean onlyFirstDifference, ReflectionComparator reflectionComparator)
compare
in interface Comparator
left
- The left object, not nullright
- The right object, not nullonlyFirstDifference
- True if only the first difference should be returnedreflectionComparator
- The root comparator for inner comparisons, not null
protected void compareFields(Object left, Object right, Class<?> clazz, ObjectDifference difference, boolean onlyFirstDifference, ReflectionComparator reflectionComparator)
left
- the left object for the comparison, not nullright
- the right object for the comparison, not nullclazz
- the type of the left object, not nulldifference
- root difference, not nullonlyFirstDifference
- True if only the first difference should be returnedreflectionComparator
- the reflection comparator, not null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |