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
ConstructorDescriptionPriorityComparator
(Function<T, jakarta.annotation.Priority> function, int nDefault) -
Method Summary
Modifier and TypeMethodDescriptionint
static <S> Comparator
<ServiceLoader.Provider<S>> Returns aComparator
that can sortServiceLoader.Provider
instances based on whether the class they provide is annotated with thePriority
annotation.reversed()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
PriorityComparator
-
-
Method Details
-
compare
- Specified by:
compare
in interfaceComparator<T>
-
forServiceLoader
Returns aComparator
that can sortServiceLoader.Provider
instances based on whether the class they provide is annotated with thePriority
annotation.- Type Parameters:
S
- the type of service provided- Returns:
- a
Comparator
to sortPriority
annotatedServiceLoader.Provider
instances
-
reversed
- Specified by:
reversed
in interfaceComparator<T>
-