public final class ServiceLocator extends java.lang.Object implements ServiceProvider<Service>
Service
implementations.Modifier and Type | Class and Description |
---|---|
static class |
ServiceLocator.DependencySet |
Modifier and Type | Method and Description |
---|---|
static ServiceLocator.DependencySet |
dependencySet() |
<T extends Service> |
getService(java.lang.Class<T> serviceType)
Looks up the
Service of the given serviceType . |
<T extends Service> |
getServicesOfType(java.lang.Class<T> serviceType)
Looks up all
Service instances that are subtypes of the given serviceType supplied. |
boolean |
knowsServiceFor(ServiceConfiguration<?,?> serviceConfig) |
void |
startAllServices() |
void |
stopAllServices() |
public static ServiceLocator.DependencySet dependencySet()
public <T extends Service> T getService(java.lang.Class<T> serviceType)
ServiceProvider
Service
of the given serviceType
.
There is no guarantee that services returned here will be started.
getService
in interface ServiceProvider<Service>
T
- the Service
typeserviceType
- the class
of the service being looked upT
, or null
if it couldn't be locatedService.start(ServiceProvider)
public <T extends Service> java.util.Collection<T> getServicesOfType(java.lang.Class<T> serviceType)
ServiceProvider
Service
instances that are subtypes of the given serviceType
supplied.
This method must be used to retrieves service types marked with the
PluralService
annotation.
getServicesOfType
in interface ServiceProvider<Service>
T
- the Service
typeserviceType
- the class
of the service being looked upserviceType
public boolean knowsServiceFor(ServiceConfiguration<?,?> serviceConfig)
public void startAllServices()
public void stopAllServices() throws java.lang.Exception
java.lang.Exception