public class SingletonServiceLoader extends Object
ServiceLoader except it returns
lists of Classes instead of an Iterable of
instances.| Constructor and Description |
|---|
SingletonServiceLoader() |
| Modifier and Type | Method and Description |
|---|---|
static <S> S |
load(Class<S> service)
Loads the classes of the providers of a service.
|
static <S> S |
load(Class<S> service,
ClassLoader loader)
Loads a service provider using
ServiceLoader, assuming that
there is only one instance of the given service provider. |
public static <S> S load(Class<S> service)
service - a service type.ServiceConfigurationError - if something goes wrong with loading
a service provider's class.public static <S> S load(Class<S> service, ClassLoader loader)
ServiceLoader, assuming that
there is only one instance of the given service provider.service - the class or interface that service providers implement
or extend.ServiceConfigurationError - if no classes were found or if
multiple classes were found.Copyright © 2012–2018 Emory University. All rights reserved.