|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.devexperts.services.Services
public class Services
Utility class that contains service-loading functionality.
Field Summary | |
---|---|
static String |
META_INF_SERVICES
|
Constructor Summary | |
---|---|
protected |
Services()
Deprecated. |
Method Summary | ||
---|---|---|
static
|
createService(Class<T> serviceClass,
ClassLoader loader,
String implClassName)
Creates service that implements given class. |
|
static
|
createServices(Class<T> serviceClass,
ClassLoader loader)
|
|
static
|
loadServiceClasses(Class<T> serviceClass,
ClassLoader loader)
|
|
static void |
startup()
Deprecated. No replacement. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String META_INF_SERVICES
Constructor Detail |
---|
@Deprecated protected Services()
Method Detail |
---|
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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |