public class Services extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
META_INF_SERVICES |
| Modifier | Constructor and Description |
|---|---|
protected |
Services()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
createService(Class<T> serviceClass,
ClassLoader loader,
String implClassName)
Creates service that implements given class.
|
static <T> Iterable<T> |
createServices(Class<T> serviceClass,
ClassLoader loader) |
static <T> List<Class<? extends T>> |
loadServiceClasses(Class<T> serviceClass,
ClassLoader loader) |
static void |
startup()
Deprecated.
No replacement.
|
public static final String META_INF_SERVICES
@Deprecated protected Services()
public static void startup()
StartupService service.
This happens once per JVM, regardless of the number of calls to this method.public static <T> T createService(Class<T> serviceClass, ClassLoader loader, String implClassName)
implClassName != null then it is used.
loader == null and system property with name serviceClass.getName()
is defined then it is used.
"META-INF/services/" + serviceClass.getName() resource is defined within
the specified loader then its first line is used.
loader == null, then the resulting implementation class name from steps 1 or 2 can have
value of the form <jar-file-or-url>!<class-name>, where both parts are optional and jar-file
is distinguished from class name by ".jar" suffix. Otherwise, if loader != null,
implementation class name can only refer to the actual name of the class and the specified loader
is used.
If loader is not otherwise defined as parameter or in implementation class name, then the first non-null class loader is taken from the below list:
serviceClass.getClassLoader()
Thread.currentThread().getContextClassLoader()
Services class is used as the last option.
serviceClass - Service class.loader - Default class loader (may be null). If it is null, then
the lookup procedure is used.implClassName - Implementation class name (may be null). If it is null, then
the lookup procedure is used.public static <T> Iterable<T> createServices(Class<T> serviceClass, ClassLoader loader)
public static <T> List<Class<? extends T>> loadServiceClasses(Class<T> serviceClass, ClassLoader loader)
Copyright © 2002–2025 Devexperts LLC. All rights reserved.