public final class ServiceLoaderProvider extends Object
ServiceLoader| Modifier and Type | Method and Description |
|---|---|
static <T> T |
get(Class<T> supplier)
Searches implementation using
ServiceLoader, and it will return the higher priority
Priority |
static <T> T |
getUnique(Class<T> supplier)
Searches implementation using
ServiceLoader, an it will return
an instance only if there is one implementation to it. |
static <T,I extends T> |
getUnique(Class<T> supplier,
Class<I> supplierImplementation)
Searches implementation using
ServiceLoader, an it will return
an instance only if there is one implementation to it. |
static <T> T |
getUnique(Class<T> supplier,
Predicate<Object> predicate)
Searches implementation using
ServiceLoader, an it will return
an instance only if there is one implementation to it. |
public static <T> T get(Class<T> supplier)
ServiceLoader, and it will return the higher priority
PriorityT - the typesupplier - the classProviderNotFoundException - when the provider is not foundNullPointerException - when supplier is nullpublic static <T> T getUnique(Class<T> supplier)
ServiceLoader, an it will return
an instance only if there is one implementation to it.T - the typesupplier - the classProviderNotFoundException - when the provider is not foundNullPointerException - when supplier is nullNonUniqueResultException - where there is more than one resultpublic static <T> T getUnique(Class<T> supplier, Predicate<Object> predicate)
ServiceLoader, an it will return
an instance only if there is one implementation to it.T - the typesupplier - the classpredicate - the predicate to set in the filterProviderNotFoundException - when the provider is not foundNullPointerException - when supplier is nullNonUniqueResultException - where there is more than one resultpublic static <T,I extends T> I getUnique(Class<T> supplier, Class<I> supplierImplementation)
ServiceLoader, an it will return
an instance only if there is one implementation to it.T - the typeI - a specific implementation of suppliersupplier - the classsupplierImplementation - to select a specific implementationProviderNotFoundException - when the provider is not foundNullPointerException - when supplier is nullNonUniqueResultException - where there is more than one resultCopyright © 2017–2019 Eclipse Foundation. All rights reserved.