@Immutable public final class ServiceLoaderHelper extends Object
ServiceLoader helper class.| Modifier and Type | Method and Description |
|---|---|
static <T> ICommonsList<T> |
getAllSPIImplementations(Class<T> aSPIClass)
Uses the
ServiceLoader to load all SPI implementations of the
passed class |
static <T> ICommonsList<T> |
getAllSPIImplementations(Class<T> aSPIClass,
ClassLoader aClassLoader)
Uses the
ServiceLoader to load all SPI implementations of the
passed class |
static <T> ICommonsList<T> |
getAllSPIImplementations(Class<T> aSPIClass,
ClassLoader aClassLoader,
org.slf4j.Logger aLogger)
Uses the
ServiceLoader to load all SPI implementations of the
passed class |
static <T> ICommonsList<T> |
getAllSPIImplementations(Class<T> aSPIClass,
org.slf4j.Logger aLogger)
Uses the
ServiceLoader to load all SPI implementations of the
passed class |
static <T> T |
getFirstSPIImplementation(Class<T> aSPIClass)
Uses the
ServiceLoader to load all SPI implementations of the
passed class and return only the first instance. |
static <T> T |
getFirstSPIImplementation(Class<T> aSPIClass,
ClassLoader aClassLoader)
Uses the
ServiceLoader to load all SPI implementations of the
passed class and return only the first instance. |
static <T> T |
getFirstSPIImplementation(Class<T> aSPIClass,
ClassLoader aClassLoader,
org.slf4j.Logger aLogger)
Uses the
ServiceLoader to load all SPI implementations of the
passed class and return only the first instance. |
static <T> T |
getFirstSPIImplementation(Class<T> aSPIClass,
org.slf4j.Logger aLogger)
Uses the
ServiceLoader to load all SPI implementations of the
passed class and return only the first instance. |
@Nonnull @ReturnsMutableCopy public static <T> ICommonsList<T> getAllSPIImplementations(@Nonnull Class<T> aSPIClass)
ServiceLoader to load all SPI implementations of the
passed classT - The implementation type to be loadedaSPIClass - The SPI interface class. May not be null.@Nonnull @ReturnsMutableCopy public static <T> ICommonsList<T> getAllSPIImplementations(@Nonnull Class<T> aSPIClass, @Nonnull ClassLoader aClassLoader)
ServiceLoader to load all SPI implementations of the
passed classT - The implementation type to be loadedaSPIClass - The SPI interface class. May not be null.aClassLoader - The class loader to use for the SPI loader. May not be
null.@Nonnull @ReturnsMutableCopy public static <T> ICommonsList<T> getAllSPIImplementations(@Nonnull Class<T> aSPIClass, @Nullable org.slf4j.Logger aLogger)
ServiceLoader to load all SPI implementations of the
passed classT - The implementation type to be loadedaSPIClass - The SPI interface class. May not be null.aLogger - An optional logger to use. May be null.@Nonnull @ReturnsMutableCopy public static <T> ICommonsList<T> getAllSPIImplementations(@Nonnull Class<T> aSPIClass, @Nonnull ClassLoader aClassLoader, @Nullable org.slf4j.Logger aLogger)
ServiceLoader to load all SPI implementations of the
passed classT - The implementation type to be loadedaSPIClass - The SPI interface class. May not be null.aClassLoader - The class loader to use for the SPI loader. May not be
null.aLogger - An optional logger to use. May be null.null.@Nullable public static <T> T getFirstSPIImplementation(@Nonnull Class<T> aSPIClass)
ServiceLoader to load all SPI implementations of the
passed class and return only the first instance.T - The implementation type to be loadedaSPIClass - The SPI interface class. May not be null.null.@Nullable public static <T> T getFirstSPIImplementation(@Nonnull Class<T> aSPIClass, @Nonnull ClassLoader aClassLoader)
ServiceLoader to load all SPI implementations of the
passed class and return only the first instance.T - The implementation type to be loadedaSPIClass - The SPI interface class. May not be null.aClassLoader - The class loader to use for the SPI loader. May not be
null.null.@Nullable public static <T> T getFirstSPIImplementation(@Nonnull Class<T> aSPIClass, @Nullable org.slf4j.Logger aLogger)
ServiceLoader to load all SPI implementations of the
passed class and return only the first instance.T - The implementation type to be loadedaSPIClass - The SPI interface class. May not be null.aLogger - An optional logger to use. May be null.null.@Nullable public static <T> T getFirstSPIImplementation(@Nonnull Class<T> aSPIClass, @Nonnull ClassLoader aClassLoader, @Nullable org.slf4j.Logger aLogger)
ServiceLoader to load all SPI implementations of the
passed class and return only the first instance.T - The implementation type to be loadedaSPIClass - The SPI interface class. May not be null.aClassLoader - The class loader to use for the SPI loader. May not be
null.aLogger - An optional logger to use. May be null.null.Copyright © 2014–2016 Philip Helger. All rights reserved.