public final class SRServices extends Object
getServices(). For
specific services, i.e. if you need an instance of IStringAlignerFactory, use
SRServices.get(IStringAlignerFactory.class).
This is thread-safe!
| Modifier and Type | Class and Description |
|---|---|
static class |
SRServices.ShutDown
Shutdown hook thread.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
SR_MAPPING
Constant of property which which sets the default implementation for
services lookup.
|
static String |
SR_THREAD_SAFE
Constant of property which enables multiple SRServices (one per thread).
|
| Modifier and Type | Method and Description |
|---|---|
protected static void |
addHook(SRServices service)
Add shutdown hook to the environment.
|
<T> void |
bind(Class<T> clazz,
T instance)
Bind a service to the SpecRunner.
|
static SRServices |
get()
Gets the instance of
SRServices. |
static <T> T |
get(Class<T> clazz)
Shortcut static method to recover a service (thread-safe).
|
static IComparatorManager |
getComparatorManager()
Shortcut method to comparator manager.
|
static IConverterManager |
getConverterManager()
Shortcut method to converter manager.
|
static IExpressionFactory |
getExpressionFactory()
Shortcut method to expression factory.
|
static IFeatureManager |
getFeatureManager()
Shortcut method to feature manager.
|
static IFormatterManager |
getFormatterManager()
Shortcut method to formatter manager.
|
static IObjectManager |
getObjectManager()
Shortcut method to feature manager.
|
static IReaderManager |
getReaderManager()
Shortcut method to reader manager.
|
Map<Class<?>,Object> |
getServices()
The map of all available services.
|
static ISpecRunner |
getSpecRunner()
Shortcut method to the topmost interface.
|
static ISpecRunnerPlugin |
getSpecRunnerPlugin()
Shortcut method to the topmost interface for programmatic plugins.
|
String |
getThreadName()
Get the thread associated to this service..
|
<T> T |
lookup(Class<T> clazz)
Lookup for a service by its type.
|
static void |
release()
Release all reusable resources pending.
|
static void |
setThreadSafe(boolean isTheadSafe) |
public static final String SR_THREAD_SAFE
public static final String SR_MAPPING
public static void setThreadSafe(boolean isTheadSafe)
public <T> void bind(Class<T> clazz, T instance)
@Before annotation
instead of @BeforeClass. Features, however, can be set on
@BeforeClass without side-effects.T - The type to be bound.clazz - The service type.instance - The service instance.public <T> T lookup(Class<T> clazz)
T - The service type.clazz - The service type.IllegalArgumentException if the service was not
previously bound.public Map<Class<?>,Object> getServices()
public String getThreadName()
public static <T> T get(Class<T> clazz)
T - A class type.clazz - see lookup.lookup.public static SRServices get()
SRServices.protected static void addHook(SRServices service)
service - A service to be shut down.public static IFeatureManager getFeatureManager()
public static IReaderManager getReaderManager()
public static IConverterManager getConverterManager()
public static IFormatterManager getFormatterManager()
public static IComparatorManager getComparatorManager()
public static IObjectManager getObjectManager()
public static IExpressionFactory getExpressionFactory()
public static ISpecRunner getSpecRunner() throws SpecRunnerException
SpecRunnerException - On recovering errors.public static ISpecRunnerPlugin getSpecRunnerPlugin() throws SpecRunnerException
SpecRunnerException - On recovering errors.public static void release()
Copyright © 2016. All rights reserved.