java.lang.Object
io.helidon.config.mp.Priorities
Priority utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intFind priority from class annotation, or return default if none found.static intFind 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 withPriorityand which applies a specified default priority if either or both classes lack the annotation.static voidSort the list based on priorities.static voidsort(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
Priorityor the default provided
-
find
Find priority for an instance. First checks if instance isPrioritized. If so, uses the value from it. Then checks forPriorityannotation. 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 withPriorityand 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 thePriorityannotation- Returns:
- comparator
-