org.specrunner.comparators.core
Class ComparatorDefault

java.lang.Object
  extended by org.specrunner.comparators.core.ComparatorDefault
All Implemented Interfaces:
Serializable, Comparator<Object>, IComparator, IResetable
Direct Known Subclasses:
AbstractComparatorTime, ComparatorNode, ComparatorString

public class ComparatorDefault
extends Object
implements IComparator

A default comparator. It compares nulls values, and if both are not null, it uses Object.equals(Object).

Author:
Thiago Santos.
See Also:
Serialized Form

Constructor Summary
ComparatorDefault()
           
 
Method Summary
 int compare(Object o1, Object o2)
           
 Class<?> getType()
          The comparator reference type.
 void initialize()
          Initialize something.
 boolean match(Object expected, Object received)
          Says if two objects can be considered equals.
protected  String toString(Object obj)
          Convert object to String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

ComparatorDefault

public ComparatorDefault()
Method Detail

getType

public Class<?> getType()
Description copied from interface: IComparator
The comparator reference type.

Specified by:
getType in interface IComparator
Returns:
The comparator target.

initialize

public void initialize()
Description copied from interface: IResetable
Initialize something.

Specified by:
initialize in interface IResetable

match

public boolean match(Object expected,
                     Object received)
Description copied from interface: IComparator
Says if two objects can be considered equals.

Specified by:
match in interface IComparator
Parameters:
expected - The expected value.
received - The received value.
Returns:
true, if they are equal, false, otherwise.

compare

public int compare(Object o1,
                   Object o2)
Specified by:
compare in interface Comparator<Object>

toString

protected String toString(Object obj)
Convert object to String.

Parameters:
obj - An object.
Returns:
A string for that object.


Copyright © 2014. All rights reserved.