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)
ServiceLoader
ClassLoader
to use to find services, in the case we don't
provide one.addClassLoader
in interface ServiceLoader
public Set load(Class serviceClass)
ServiceLoader
Set
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 ClassLoader
s provided
with the ServiceLoader.addClassLoader(ClassLoader)
method, if any.load
in interface ServiceLoader
serviceClass
- the interface or class which the loaded objects must implement
or extendSet
of loaded object instancespublic Set load(Class serviceClass, ClassLoader classLoader)
ServiceLoader
Set
of a object instances which implement or extended a
common service interface or class. The classes are loaded through the
provided ClassLoader
load
in interface ServiceLoader
serviceClass
- the interface or class which the loaded objects must implement
or extendclassLoader
- the ClassLoader
to load the classes fromSet
of loaded object instances