Package com.tangosol.util.comparator
Class PriorityComparator<T>
java.lang.Object
com.tangosol.util.comparator.PriorityComparator<T>
- Type Parameters:
T- the type to be ordered
- All Implemented Interfaces:
Comparator<T>
A
Comparator that orders values that are annotated with
the Priority annotation.- Since:
- 22.06
- Author:
- Jonathan Knight 2022.05.25
-
Constructor Summary
ConstructorsConstructorDescriptionPriorityComparator(Function<T, javax.annotation.Priority> function, int nDefault) -
Method Summary
Modifier and TypeMethodDescriptionintstatic <S> Comparator<ServiceLoader.Provider<S>> Returns aComparatorthat can sortServiceLoader.Providerinstances based on whether the class they provide is annotated with thePriorityannotation.reversed()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
PriorityComparator
-
-
Method Details
-
compare
- Specified by:
comparein interfaceComparator<T>
-
forServiceLoader
Returns aComparatorthat can sortServiceLoader.Providerinstances based on whether the class they provide is annotated with thePriorityannotation.- Type Parameters:
S- the type of service provided- Returns:
- a
Comparatorto sortPriorityannotatedServiceLoader.Providerinstances
-
reversed
- Specified by:
reversedin interfaceComparator<T>
-