public final class Services extends Object
ServiceLoader. Decouples loading logic for
better separation of concerns and testability.| Modifier and Type | Method and Description |
|---|---|
static <T> List<T> |
loadAll(Class<T> spi)
Loads and instantiates all service implementation of the given SPI class and returns them as a List.
|
static <T> T |
loadFirst(Class<T> spi)
Loads the first available implementation the given SPI class from the classpath.
|
public static <T> List<T> loadAll(Class<T> spi)
T - The type of the SPIspi - The class of the Service Provider Interfacepublic static <T> T loadFirst(Class<T> spi)
ServiceLoader
to find implementations. When multiple implementations are available it will return the first one that it
encounters. There is no guarantee with regard to ordering.T - The type of the SPIspi - The class of the Service Provider InterfaceUnavailableImplementationException - When no implementation the SPI is available on the classpath.Copyright © 2014–2020 jsonwebtoken.io. All rights reserved.