public class DefaultServiceLoader extends Object implements ServiceLoader
To register your implementations classes eLfor a service, use the mechanism explained in the Java JAR file specification for the JDK version you are using:
| Constructor and Description |
|---|
DefaultServiceLoader()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addClassLoader(ClassLoader classLoader)
Adds a
ClassLoader to use to find services, in the case we don't
provide one. |
Set |
load(Class serviceClass)
Loads a
Set of a object instances which implement or extended a
common service interface or class. |
Set |
load(Class serviceClass,
ClassLoader classLoader)
Loads a
Set of a object instances which implement or extended a
common service interface or class. |
public void addClassLoader(ClassLoader classLoader)
ServiceLoaderClassLoader to use to find services, in the case we don't
provide one.addClassLoader in interface ServiceLoaderpublic Set load(Class serviceClass)
ServiceLoaderSet of a object instances which implement or extended a
common service interface or class. The services will be loaded using the
current ClassLoader and the list of ClassLoaders provided
with the ServiceLoader.addClassLoader(ClassLoader) method, if any.load in interface ServiceLoaderserviceClass - the interface or class which the loaded objects must implement
or extendSet of loaded object instancespublic Set load(Class serviceClass, ClassLoader classLoader)
ServiceLoaderSet of a object instances which implement or extended a
common service interface or class. The classes are loaded through the
provided ClassLoaderload in interface ServiceLoaderserviceClass - the interface or class which the loaded objects must implement
or extendclassLoader - the ClassLoader to load the classes fromSet of loaded object instances