public enum JNXServiceFinder extends Enum<JNXServiceFinder>
Modifier and Type | Method and Description |
---|---|
static <T> T |
findRequiredService(Class<T> serviceClass,
ClassLoader cl)
Finds a single implementation of the provided service class using the provided classloader,
throwing an exception if none can be found.
|
static <T> Stream<T> |
findServices(Class<T> serviceClass)
Finds services implementing the provided service class using the context classloader.
|
static <T> Stream<T> |
findServices(Class<T> serviceClass,
ClassLoader cl)
Finds services implementing the provided service class using the provided classloader.
|
static JNXServiceFinder |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static JNXServiceFinder[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static JNXServiceFinder[] values()
for (JNXServiceFinder c : JNXServiceFinder.values()) System.out.println(c);
public static JNXServiceFinder valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static <T> Stream<T> findServices(Class<T> serviceClass)
public static <T> Stream<T> findServices(Class<T> serviceClass, ClassLoader cl)
T
- the type of service to loadserviceClass
- a Class
object representing <T>
cl
- the ClassLoader
to use to load servicesStream
of service implementationspublic static <T> T findRequiredService(Class<T> serviceClass, ClassLoader cl)
T
- the type of service to loadserviceClass
- a Class
object representing <T>
cl
- the ClassLoader
to use to load servicesIllegalStateException
- if no implementation can be foundCopyright © 2019–2021 HCL. All rights reserved.