@NoExtend public abstract class AbstractServiceRegistry extends Object implements ServiceRegistry
ServiceRegistry
that enforce common behaviour for all implementations.Constructor and Description |
---|
AbstractServiceRegistry() |
Modifier and Type | Method and Description |
---|---|
protected abstract <T> Collection<T> |
doLookupProviders(Class<T> providerClass,
ClassLoader loader)
Retrieves a collection of providers.
|
<T> T |
lookupProvider(Class<T> providerClass,
ClassLoader classLoader)
Searches for implementations of a particular service class.
|
<T> Collection<T> |
lookupProviders(Class<T> providerClass,
ClassLoader classLoader)
If
classLoader is null , then the current Thread.getContextClassLoader() will be used Searches for implementations of a particular service class using the given class loader. |
public final <T> Collection<T> lookupProviders(Class<T> providerClass, ClassLoader classLoader)
classLoader
is null
, then the current Thread.getContextClassLoader()
will be used Searches for implementations of a particular service class using the given class loader.lookupProviders
in interface ServiceRegistry
providerClass
- a Class
object indicating the class or interface of the service providers being detected.classLoader
- the class loader to be used to load provider/configuration files and instantiate provider instances. If
null
, it will be up to the implementation to choose a ClassLoader
Collection
that yields provider objects for the given service, in some arbitrary order.protected abstract <T> Collection<T> doLookupProviders(Class<T> providerClass, ClassLoader loader)
{@link #lookupProviders(Class, ClassLoader)},
and {@code {@link #lookupProvider(Class, ClassLoader)}}
.providerClass
- a Class
object indicating the class or interface of the service providers being detected.loader
- the class loader to be used to load provider/configuration files and instantiate provider instances. If
null
, it will be up to the implementation to choose a ClassLoader
Collection
that yields provider objects for the given service, in some arbitrary order.public final <T> T lookupProvider(Class<T> providerClass, ClassLoader classLoader)
lookupProvider
in interface ServiceRegistry
providerClass
- a Class
object indicating the class or interface of the service providers being detected.classLoader
- the class loader to be used to load provider/configuration files and instantiate provider instances. If
null
, it will be up to the implementation to choose a ClassLoader
Copyright © 2018. All rights reserved.