@Concealed
public class SandboxServiceLoader
extends java.lang.Object
Utility class that helps loading services supporting unified sandbox framework.
| Modifier and Type | Class and Description |
|---|---|
static interface |
SandboxServiceLoader.ServiceDescriptor<P,S>
Describes how to load a service.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getFirstServiceProviderName(java.lang.Class<?> service,
java.lang.ClassLoader loader)
Returns the full name of the first service provider found by the given
class loader.
|
static <P,S> S |
getService(SandboxServiceLoader.ServiceDescriptor<P,S> descriptor)
Loads a service.
|
static <S> S |
newServiceInstance(java.lang.Class<S> service,
java.lang.String providerName,
java.lang.ClassLoader classLoader)
Creates a new instance of a service provider class identified by its full
name.
|
public static <P,S> S getService(SandboxServiceLoader.ServiceDescriptor<P,S> descriptor)
S - the type of the serviceP - the type of the service providerdescriptor - the description of the service to be loadedpublic static <S> S newServiceInstance(java.lang.Class<S> service,
java.lang.String providerName,
java.lang.ClassLoader classLoader)
S - the type (base class) of the serviceservice - the Class object of the service typeproviderName - the full name of the provider classclassLoader - the class loader that can load the provider class
null if system class loader should
load the provider classpublic static java.lang.String getFirstServiceProviderName(java.lang.Class<?> service,
java.lang.ClassLoader loader)
service - the service (base) classloader - the class loader used to locate the service providers;
null if the system class loader should be
used