java.lang.Object
io.helidon.config.mp.Priorities
Priority utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
Find priority from class annotation, or return default if none found.static int
Find priority for an instance.static <S> Comparator
<S> priorityComparator
(int defaultPriority) Returns a comparator for two objects, the classes for which are implementations ofPrioritized
, and/or optionally annotated withPriority
and which applies a specified default priority if either or both classes lack the annotation.static void
Sort the list based on priorities.static void
sort
(List<? extends Prioritized> list) Sort the prioritized list based on priorities.
-
Method Details
-
find
Find priority from class annotation, or return default if none found.- Parameters:
aClass
- class to analyzeddefaultPriority
- default priority of this class- Returns:
- priority from
Priority
or the default provided
-
find
Find priority for an instance. First checks if instance isPrioritized
. If so, uses the value from it. Then checks forPriority
annotation. If none of the above is found, returns the default priority.- Parameters:
anObject
- object to find priority fordefaultPriority
- default priority to use- Returns:
- priority of the object or default provided
-
sort
Sort the prioritized list based on priorities.- Parameters:
list
- list to sort
-
sort
Sort the list based on priorities.- If element implements
Prioritized
, uses its priority. - If element is a class and has annotation
Priority
, uses its priority - If element is any object and its class has annotation
Priority
, uses its priority
- Parameters:
list
- list to sortdefaultPriority
- default priority for elements that do not have it
- If element implements
-
priorityComparator
Returns a comparator for two objects, the classes for which are implementations ofPrioritized
, and/or optionally annotated withPriority
and which applies a specified default priority if either or both classes lack the annotation.- Type Parameters:
S
- type of object being compared- Parameters:
defaultPriority
- used if the classes for either or both objects lack thePriority
annotation- Returns:
- comparator
-