Class StandardTypeComparator
- java.lang.Object
- org.springframework.expression.spel.support.StandardTypeComparator
- All Implemented Interfaces:
TypeComparator
public class StandardTypeComparator extends Object implements TypeComparator
A basicTypeComparator
implementation: supports comparison ofNumber
types as well as types implementingComparable
.- Since:
- 3.0
- Author:
- Andy Clement, Juergen Hoeller, Giovanni Dall'Oglio Risso
Constructor Summary
Constructors Constructor Description StandardTypeComparator()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canCompare(Object left, Object right)
Returntrue
if the comparator can compare these two objects.int
compare(Object left, Object right)
Compare two given objects.
Constructor Detail
StandardTypeComparator
public StandardTypeComparator()
Method Detail
canCompare
public boolean canCompare(@Nullable Object left, @Nullable Object right)
Description copied from interface:TypeComparator
Returntrue
if the comparator can compare these two objects.- Specified by:
canCompare
in interfaceTypeComparator
- Parameters:
left
- the first objectright
- the second object- Returns:
true
if the comparator can compare these objects
compare
public int compare(@Nullable Object left, @Nullable Object right) throws SpelEvaluationException
Description copied from interface:TypeComparator
Compare two given objects.- Specified by:
compare
in interfaceTypeComparator
- Parameters:
left
- the first objectright
- the second object- Returns:
- 0 if they are equal, <0 if the first is smaller than the second, or>0 if the first is larger than the second
- Throws:
SpelEvaluationException