类 AnnotationAwareOrderComparator

java.lang.Object
cn.taketoday.core.OrderComparator
cn.taketoday.core.annotation.AnnotationAwareOrderComparator
所有已实现的接口:
Comparator<Object>

public class AnnotationAwareOrderComparator extends OrderComparator
AnnotationAwareOrderComparator is an extension of OrderComparator that supports Ordered interface as well as the @Order and @Priority annotations, with an order value provided by an Ordered instance overriding a statically defined annotation value (if any).

Consult the Javadoc for OrderComparator for details on the sort semantics for non-ordered objects.

从以下版本开始:
4.0 2021/9/12 11:35
作者:
Juergen Hoeller, Oliver Gierke, Stephane Nicoll, Harry Yang
另请参阅:
  • 字段详细资料

  • 构造器详细资料

    • AnnotationAwareOrderComparator

      public AnnotationAwareOrderComparator()
  • 方法详细资料

    • findOrder

      @Nullable protected Integer findOrder(@Nullable Object obj)
      This implementation checks for @Order or @Priority on various kinds of elements, in addition to the Ordered check in the superclass.
      覆盖:
      findOrder 在类中 OrderComparator
      参数:
      obj - the object to check
      返回:
      the order value, or null if none found
    • findOrderFromAnnotation

      @Nullable private Integer findOrderFromAnnotation(Object obj)
    • getPriority

      @Nullable public Integer getPriority(Object obj)
      This implementation retrieves an @Priority value, allowing for additional semantics over the regular @Order annotation: typically, selecting one object over another in case of multiple matches but only one object to be returned.
      覆盖:
      getPriority 在类中 OrderComparator
      参数:
      obj - the object to check
      返回:
      the priority value, or null if none
    • sort

      public static void sort(List<?> list)
      Sort the given list with a default AnnotationAwareOrderComparator.

      Optimized to skip sorting for lists with size 0 or 1, in order to avoid unnecessary array extraction.

      参数:
      list - the List to sort
      另请参阅:
    • sort

      public static void sort(Object[] array)
      Sort the given array with a default AnnotationAwareOrderComparator.

      Optimized to skip sorting for lists with size 0 or 1, in order to avoid unnecessary array extraction.

      参数:
      array - the array to sort
      另请参阅:
    • sortIfNecessary

      public static void sortIfNecessary(@Nullable Object value)
      Sort the given array or List with a default AnnotationAwareOrderComparator, if necessary. Simply skips sorting when given any other value.

      Optimized to skip sorting for lists with size 0 or 1, in order to avoid unnecessary array extraction.

      参数:
      value - the array or List to sort
      另请参阅: