org.springframework.core.convert.converter

## 类 ConvertingComparator<S,T>

- java.lang.Object
- - org.springframework.core.convert.converter.ConvertingComparator<S,T>

- 类型参数:
    `S` - the source type
    `T` - the target type
  所有已实现的接口:
    Comparator<S>

      public class ConvertingComparator<S,T>
      extends Object
      implements Comparator<S>

  A `Comparator` that converts values before they are compared. The specified `Converter` will be used to convert each value before it passed to the underlying `Comparator`.
  从以下版本开始:
    3.2
  作者:
    Phillip Webb

- - ### 构造器概要

    构造器
    构造器和说明
    `ConvertingComparator(Comparator<T> comparator, ConversionService conversionService, Class<? extends T> targetType)` Create a new `ConvertingComparator` instance.
    `ConvertingComparator(Comparator<T> comparator, Converter<S,T> converter)` Create a new `ConvertingComparator` instance.
    `ConvertingComparator(Converter<S,T> converter)` Create a new `ConvertingComparator` instance.

  - ### 方法概要

    所有方法 静态方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `int` | `compare(S o1, S o2)`
    `static <K,V> ConvertingComparator<Map.Entry<K,V>,K>` | `mapEntryKeys(Comparator<K> comparator)` Create a new `ConvertingComparator` that compares `map * entries` based on their `keys`.
    `static <K,V> ConvertingComparator<Map.Entry<K,V>,V>` | `mapEntryValues(Comparator<V> comparator)` Create a new `ConvertingComparator` that compares `map entries` based on their `values`.

    - ### 从类继承的方法 java.lang.Object

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

    - ### 从接口继承的方法 java.util.Comparator

      `comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### 构造器详细资料

    - #### ConvertingComparator

          public ConvertingComparator(Converter<S,T> converter)

      Create a new `ConvertingComparator` instance.
      参数:
        `converter` - the converter

    - #### ConvertingComparator

          public ConvertingComparator(Comparator<T> comparator,
                                      Converter<S,T> converter)

      Create a new `ConvertingComparator` instance.
      参数:
        `comparator` - the underlying comparator used to compare the converted values
        `converter` - the converter

    - #### ConvertingComparator

          public ConvertingComparator(Comparator<T> comparator,
                                      ConversionService conversionService,
                                      Class<? extends T> targetType)

      Create a new `ConvertingComparator` instance.
      参数:
        `comparator` - the underlying comparator
        `conversionService` - the conversion service
        `targetType` - the target type

  - ### 方法详细资料

    - #### compare

          public int compare(S o1,
                             S o2)

      指定者:
        `compare` 在接口中 `Comparator<S>`

    - #### mapEntryKeys

          public static <K,V> ConvertingComparator<Map.Entry<K,V>,K> mapEntryKeys(Comparator<K> comparator)

      Create a new `ConvertingComparator` that compares `map * entries` based on their `keys`.
      参数:
        `comparator` - the underlying comparator used to compare keys
      返回:
        a new `ConvertingComparator` instance

    - #### mapEntryValues

          public static <K,V> ConvertingComparator<Map.Entry<K,V>,V> mapEntryValues(Comparator<V> comparator)

      Create a new `ConvertingComparator` that compares `map entries` based on their `values`.
      参数:
        `comparator` - the underlying comparator used to compare values
      返回:
        a new `ConvertingComparator` instance