public final class PriorityUtils extends Object
Modifier and Type | Method and Description |
---|---|
static int |
priorityOf(Class<?> someClass)
Retrieves the priority of a class by using the value of the
Priority annotation
present on the class or on
its superclasses. |
static int |
priorityOfClassOf(Object object)
Calls
priorityOf(Class) on the class of the specified object. |
static <T extends Class<?>> |
sortByPriority(List<T> someClasses)
A specialisation of
sortByPriority(List, ToIntFunction) for a list of classes. |
static <T> void |
sortByPriority(List<T> someClasses,
ToIntFunction<T> priorityExtractor)
Sort classes by descending order of their priority, meaning the class with
the higher priority will
be the first element of the sorted list.
|
public static <T extends Class<?>> void sortByPriority(List<T> someClasses)
sortByPriority(List, ToIntFunction)
for a list of classes.someClasses
- the list of classes to sort.public static <T> void sortByPriority(List<T> someClasses, ToIntFunction<T> priorityExtractor)
someClasses
- the list of classes to sort.priorityExtractor
- a function that extract a priority from an item.public static int priorityOf(Class<?> someClass)
Priority
annotation
present on the class or on
its superclasses. If no annotation is found, the returned priority is 0.someClass
- the class to extract priority from.public static int priorityOfClassOf(Object object)
priorityOf(Class)
on the class of the specified object.object
- the object from which to extract class from which to extract priority.Copyright © 2013-2018–2019 SeedStack. All rights reserved.