|
OCPsoft Common API 1.0.5.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ocpsoft.common.services.ServiceLoader<S>
public class ServiceLoader<S>
This class handles looking up service providers on the class path. It implements the Service Provider section of the JAR File Specification. The Service Provider programmatic lookup was not specified prior to Java 6 so this interface allows use of the specification prior to Java 6. The API is copied from java.util.ServiceLoader
| Method Summary | ||
|---|---|---|
Iterator<S> |
iterator()
Lazily loads the available providers of this loader's service. |
|
static
|
load(Class<S> service)
Creates a new service loader for the given service type, using the current thread's context class loader. |
|
static
|
load(Class<S> service,
ClassLoader loader)
Creates a new service loader for the given service type and class loader. |
|
static
|
loadEnriched(Class<T> serviceClass)
Obtain a Class instance and attempt enrichment using any provided ServiceEnricher classes. |
|
static
|
loadTypesafe(Class<S> service)
Creates a new service loader for the given service type, using the current thread's context class loader. |
|
void |
reload()
Clear this loader's provider cache so that all providers will be reloaded. |
|
String |
toString()
Returns a string describing this service. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static <S> ServiceLoader load(Class<S> service)
ServiceLoader.load(service)</code>
is equivalent to
ServiceLoader.load(service,
Thread.currentThread().getContextClassLoader())
service - The interface or abstract class representing the service
public static <S> ServiceLoader<S> loadTypesafe(Class<S> service)
ServiceLoader.load(service)</code>
is equivalent to
ServiceLoader.load(service,
Thread.currentThread().getContextClassLoader())
service - The interface or abstract class representing the service
public static <S> ServiceLoader<S> load(Class<S> service,
ClassLoader loader)
service - The interface or abstract class representing the serviceloader - The class loader to be used to load provider-configuration files and provider classes, or null if
the system class loader (or, failing that, the bootstrap class loader) is to be used
public void reload()
public static <T> Collection<T> loadEnriched(Class<T> serviceClass)
Class instance and attempt enrichment using any provided ServiceEnricher classes.
public Iterator<S> iterator()
iterator in interface Iterable<S>public String toString()
toString in class Object
|
OCPsoft Common API 1.0.5.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||