public class ServiceLocator extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
findService(Class<T> serviceClass)
Get the service with the given type.
|
<T> T |
getService(Class<T> serviceClass)
Get the service of the given type.
|
Object |
getService(String serviceName)
Deprecated.
Use
getService(Class) or getService(String, Class) instead. |
<T> T |
getService(String serviceName,
Class<T> serviceClass)
Get a service by name that has the given type.
|
VirusScanner |
getVirusScanner() |
static ServiceLocator |
instance()
Get the singleton instance.
|
static boolean |
isApplicationContextAvailable() |
public static final <T> T findService(Class<T> serviceClass)
instance().
getService(Class). If the service does not exist or the application context was not
initialized a runtime exception will be thrown.T - Type of the serviceserviceClass - Class of the servicepublic static final ServiceLocator instance()
public static boolean isApplicationContextAvailable()
instance() will return not
nullpublic <T> T getService(Class<T> serviceClass)
T - Type of the serviceserviceClass - Class of the service@Deprecated public Object getService(String serviceName)
getService(Class) or getService(String, Class) instead.serviceName - The name of the servicepublic <T> T getService(String serviceName, Class<T> serviceClass)
T - Type of the serviceserviceName - The name of the serviceserviceClass - Class of the servicepublic VirusScanner getVirusScanner() throws InitializeException
InitializeException - if virus scanning is enabled but the selected scanner was not correctly
initializedCopyright © 2019 Communote team. All rights reserved.