public class ServiceLocator extends java.lang.Object implements ServiceRegistry
| Modifier and Type | Class and Description |
|---|---|
static class |
ServiceLocator.ServiceFactory<T> |
| Constructor and Description |
|---|
ServiceLocator(java.lang.ClassLoader classLoader) |
| Modifier and Type | Method and Description |
|---|---|
<T> ServiceLocator.ServiceFactory<T> |
findFactory(java.lang.Class<T> serviceType)
Locates a factory for a given service.
|
<T> T |
get(java.lang.Class<T> serviceType)
Locates the service of the given type.
|
<T> ServiceLocator.ServiceFactory<T> |
getFactory(java.lang.Class<T> serviceType)
Locates a factory which can create services of the given type.
|
<T> T |
newInstance(java.lang.Class<T> type)
Creates a new service instance of the given type.
|
public <T> T get(java.lang.Class<T> serviceType)
throws UnknownServiceException
ServiceRegistryget in interface ServiceRegistryT - The service type.serviceType - The service type.UnknownServiceException - When there is no service of the given type available.public <T> ServiceLocator.ServiceFactory<T> getFactory(java.lang.Class<T> serviceType) throws UnknownServiceException
ServiceRegistrygetFactory in interface ServiceRegistryT - The service type that the factory should create.serviceType - The service type that the factory should create.UnknownServiceException - When there is no factory available for services of the given type.public <T> ServiceLocator.ServiceFactory<T> findFactory(java.lang.Class<T> serviceType)
public <T> T newInstance(java.lang.Class<T> type)
throws UnknownServiceException
ServiceRegistrynewInstance in interface ServiceRegistryT - The service type.type - The service typeUnknownServiceException - When there is no factory available for services of the given type.Copyright © 2013. All rights reserved