public class DefaultServiceLoader extends java.lang.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(java.lang.ClassLoader classLoader)
Adds a
ClassLoader to use to find services, in the case we don't
provide one. |
java.util.Set |
load(java.lang.Class serviceClass)
Loads a
Set of a object instances which implement or extended a
common service interface or class. |
java.util.Set |
load(java.lang.Class serviceClass,
java.lang.ClassLoader classLoader)
Loads a
Set of a object instances which implement or extended a
common service interface or class. |
public void addClassLoader(java.lang.ClassLoader classLoader)
ServiceLoader
ClassLoader
to use to find services, in the case we don't
provide one.addClassLoader
in interface ServiceLoader
public java.util.Set load(java.lang.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 java.util.Set load(java.lang.Class serviceClass, java.lang.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