类 AnnotationAwareOrderComparator
java.lang.Object
cn.taketoday.core.OrderComparator
cn.taketoday.core.annotation.AnnotationAwareOrderComparator
- 所有已实现的接口:
Comparator<Object>
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
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明static final AnnotationAwareOrderComparatorShared default instance ofAnnotationAwareOrderComparator. -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected Integerprivate IntegergetPriority(Object obj) static voidSort the given array with a default AnnotationAwareOrderComparator.static voidSort the given list with a defaultAnnotationAwareOrderComparator.static voidsortIfNecessary(Object value) Sort the given array or List with a default AnnotationAwareOrderComparator, if necessary.从类继承的方法 cn.taketoday.core.OrderComparator
compare, getOrder, withSourceProvider从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
字段详细资料
-
INSTANCE
Shared default instance ofAnnotationAwareOrderComparator.
-
-
构造器详细资料
-
AnnotationAwareOrderComparator
public AnnotationAwareOrderComparator()
-
-
方法详细资料
-
findOrder
This implementation checks for@Orderor@Priorityon various kinds of elements, in addition to theOrderedcheck in the superclass.- 覆盖:
findOrder在类中OrderComparator- 参数:
obj- the object to check- 返回:
- the order value, or
nullif none found
-
findOrderFromAnnotation
-
getPriority
This implementation retrieves an @Priorityvalue, allowing for additional semantics over the regular @Orderannotation: 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
nullif none
-
sort
Sort the given list with a defaultAnnotationAwareOrderComparator.Optimized to skip sorting for lists with size 0 or 1, in order to avoid unnecessary array extraction.
- 参数:
list- the List to sort- 另请参阅:
-
sort
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
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- 另请参阅:
-