public class AnnotationAwareOrderComparator extends OrderComparator
AnnotationAwareOrderComparator is an extension of
 OrderComparator that supports Spring's
 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.
OrderComparator.OrderSourceProvider| Modifier and Type | Field and Description | 
|---|---|
| static AnnotationAwareOrderComparator | INSTANCEShared default instance of  AnnotationAwareOrderComparator. | 
| Constructor and Description | 
|---|
| AnnotationAwareOrderComparator() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected Integer | findOrder(Object obj) | 
| Integer | getPriority(Object obj) | 
| static void | sort(List<?> list)Sort the given list with a default  AnnotationAwareOrderComparator. | 
| static void | sort(Object[] array)Sort the given array with a default AnnotationAwareOrderComparator. | 
| static void | sortIfNecessary(Object value)Sort the given array or List with a default AnnotationAwareOrderComparator,
 if necessary. | 
compare, getOrder, withSourceProviderclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongpublic static final AnnotationAwareOrderComparator INSTANCE
AnnotationAwareOrderComparator.@Nullable protected Integer findOrder(Object obj)
@Order or
 @Priority on various kinds of
 elements, in addition to the Ordered
 check in the superclass.findOrder in class OrderComparatorobj - the object to checknull if none found@Nullable public Integer getPriority(Object obj)
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 in class OrderComparatorobj - the object to checknull if nonepublic static void sort(List<?> list)
AnnotationAwareOrderComparator.
 Optimized to skip sorting for lists with size 0 or 1, in order to avoid unnecessary array extraction.
list - the List to sortList.sort(java.util.Comparator)public static void sort(Object[] array)
Optimized to skip sorting for lists with size 0 or 1, in order to avoid unnecessary array extraction.
array - the array to sortArrays.sort(Object[], java.util.Comparator)public static void sortIfNecessary(Object 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 sortArrays.sort(Object[], java.util.Comparator)