T - Type of the service to be loadedpublic final class HelidonServiceLoader<T> extends Object implements Iterable<T>
This service loader:
Prioritized
or by PriorityHelidonServiceLoader.Builder.addExcludedClass(Class) or HelidonServiceLoader.Builder.addExcludedClassName(String) or
by a system property "io.helidon.common.serviceloader.exclude" that defines
a comma separated list of fully qualified class names to be excluded.
Note that if a class implements more than one service, it would be excluded from all.Note on priority handling
Service priority is defined by:
HelidonServiceLoader.Builder.addService(Object, int) (if used)Prioritized.priority() if service implements itPriority annotation if presentPrioritized.DEFAULT_PRIORITY is used
@Priority(4500)
public class MyServiceImpl implements Service, Prioritized {
public int priority() {
return 6200;
}
}
Such a service would have a priority of 6200 as that is more significant than the annotation.
A service with lower priority number is returned before a service with a higher priority number.
Services with the same priority have order defined by the order they are in the configured services
and then as they are loaded from the ServiceLoader.
Negative priorities are not allowed.
A service with priority 1 will be returned before a service with priority 2.
ServiceLoader,
builder(java.util.ServiceLoader)| Modifier and Type | Class and Description |
|---|---|
static class |
HelidonServiceLoader.Builder<T>
Fluent api builder for
HelidonServiceLoader. |
| Modifier and Type | Field and Description |
|---|---|
static String |
SYSTEM_PROPERTY_EXCLUDE
System property used to exclude some implementation from the list of services that are configured for Java Service
loader or services that are registered using
HelidonServiceLoader.Builder. |
| Modifier and Type | Method and Description |
|---|---|
List<T> |
asList()
Provides a list of service implementations in prioritized order.
|
static <T> HelidonServiceLoader.Builder<T> |
builder(ServiceLoader<T> serviceLoader)
Create a builder for customizable service loader.
|
static <T> HelidonServiceLoader<T> |
create(ServiceLoader<T> serviceLoader)
Create a prioritized service loader from a Java Service loader.
|
void |
forEach(Consumer<? super T> action) |
Iterator<T> |
iterator() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitspliteratorpublic static final String SYSTEM_PROPERTY_EXCLUDE
HelidonServiceLoader.Builder.public static <T> HelidonServiceLoader.Builder<T> builder(ServiceLoader<T> serviceLoader)
T - type of the serviceserviceLoader - the Java Service loader used to get service implementationspublic static <T> HelidonServiceLoader<T> create(ServiceLoader<T> serviceLoader)
T - type of the serviceserviceLoader - the Java service loaderCopyright © 2018–2019 Oracle Corporation. All rights reserved.