public final class SoftServiceLoader<S> extends Object implements Iterable
Variation of ServiceLoader that allows soft loading and conditional loading of META-INF/services classes.
S - The service type| Modifiers | Name | Description |
|---|---|---|
static String |
META_INF_SERVICES |
|
static String |
PROPERTY_GRAILS_CLASSLOADER_LOGGING |
|
static org.slf4j.Logger |
REFLECTION_LOGGER |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public Optional<ServiceDefinition<S>> |
first()
|
|
public Optional<ServiceDefinition<S>> |
firstOr(String alternative, ClassLoader classLoader)
|
|
public static org.slf4j.Logger |
getLogger(Class type)Special case getLogger method that should be used by classes that are used in the annotation processor. |
|
public boolean |
hasNext() |
|
public Iterator<ServiceDefinition<S>> |
iterator()
|
<S> |
public static SoftServiceLoader<S> |
load(Class<S> service)Creates a new SoftServiceLoader using the thread context loader by default. |
<S> |
public static SoftServiceLoader<S> |
load(Class<S> service, ClassLoader loader)Creates a new SoftServiceLoader using the given type and class loader. |
<S> |
public static SoftServiceLoader<S> |
load(Class<S> service, ClassLoader loader, Predicate<String> condition)Creates a new SoftServiceLoader using the given type and class loader. |
|
protected ServiceDefinition<S> |
newService(String name, Optional<Class> loadedClass)
|
|
public ServiceDefinition<S> |
next() |
alternative - An alternative type to use if the type is not presentclassLoader - The classloader Special case getLogger method that should be used by classes that are used in the annotation processor.
type - The type
Creates a new SoftServiceLoader using the thread context loader by default.
service - The service typeS - The service generic typeCreates a new SoftServiceLoader using the given type and class loader.
service - The service typeloader - The class loaderS - The service generic typeCreates a new SoftServiceLoader using the given type and class loader.
service - The service typeloader - The class loader to usecondition - A Predicate to use to conditionally load the service. The predicate is passed the service class nameS - The service generic type
name - The nameloadedClass - The loaded class