org.springframework.expression.spel.support

## Class StandardTypeComparator

- java.lang.Object
- - org.springframework.expression.spel.support.StandardTypeComparator

- All Implemented Interfaces:
    TypeComparator

      public class StandardTypeComparator
      extends Object
      implements TypeComparator

  A simple basic `TypeComparator` implementation. It supports comparison of Numbers and types implementing Comparable.
  Since:
    3.0
  Author:
    Andy Clement, Juergen Hoeller

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StandardTypeComparator()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canCompare(Object left, Object right)` Return `true` if the comparator can compare these two objects.
    `int` | `compare(Object left, Object right)` Compare two given objects.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StandardTypeComparator

          public StandardTypeComparator()

  - ### Method Detail

    - #### canCompare

          public boolean canCompare(Object left,
                           Object right)

      Description copied from interface: `TypeComparator`
      Return `true` if the comparator can compare these two objects.
      Specified by:
        `canCompare` in interface `TypeComparator`
      Parameters:
        `left` - the first object
        `right` - the second object
      Returns:
        `true` if the comparator can compare these objects

    - #### compare

          public int compare(Object left,
                    Object right)
                      throws SpelEvaluationException

      Description copied from interface: `TypeComparator`
      Compare two given objects.
      Specified by:
        `compare` in interface `TypeComparator`
      Parameters:
        `left` - the first object
        `right` - 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`