T
- the type to produce
public class SingletonServiceLoader<T> extends Object implements Producer<T>
T
with a
ServiceLoader
.Modifier and Type | Field and Description |
---|---|
private Class<? extends T> |
clazz |
private T |
defaultImplementation |
private boolean |
failIfNotFound |
private T |
implementation |
private static org.slf4j.Logger |
LOG |
private ServiceLoader<? extends T> |
serviceLoader |
Constructor and Description |
---|
SingletonServiceLoader(Class<? extends T> c,
boolean failIfNotFound) |
SingletonServiceLoader(Class<? extends T> c,
boolean failIfNotFound,
T defaultImplementation) |
Modifier and Type | Method and Description |
---|---|
T |
get()
Get default Producer result
|
T |
get(Locale language)
Get language specific Producer result
|
T |
get(String datasourceIdentifier) |
protected void |
processImplementation(T implementation)
Classes extending this class may overwrite the default (empty)
implementation.
|
private static final org.slf4j.Logger LOG
private final boolean failIfNotFound
private final ServiceLoader<? extends T> serviceLoader
private T implementation
private T defaultImplementation
public final T get() throws ConfigurationException
Producer
get
in interface Producer<T>
ConfigurationException
public T get(Locale language)
Producer
protected void processImplementation(T implementation) throws ConfigurationException
implementation
- the loaded implementation
ConfigurationException
- if the processing failsCopyright © 2012-2015 52north.org. All Rights Reserved.