use of io.helidon.common.Prioritized in project helidon by oracle.
the class PriorityBag method add.
/**
* Add an element to the bag.
* <p>
* If the element's class is annotated with the {@link jakarta.annotation.Priority}
* annotation then that value will be used to determine priority otherwise the
* default priority value will be used.
*
* @param value the element to add
*/
public void add(T value) {
if (value != null) {
int priority;
if (value instanceof Prioritized) {
priority = ((Prioritized) value).priority();
} else {
Priority annotation = value.getClass().getAnnotation(Priority.class);
priority = annotation == null ? defaultPriority : annotation.value();
}
add(value, priority);
}
}
Aggregations