public class SimpleServiceRegistry extends Object implements ServiceRegistry
| Constructor and Description |
|---|
SimpleServiceRegistry() |
| Modifier and Type | Method and Description |
|---|---|
<S extends Service> |
add(Class<S> type,
S service)
Add a service
|
void |
addAll(Collection<Map.Entry<Class<? extends Service>,Service>> services)
Add services
|
<S extends Service> |
addIfAbsent(Class<S> type,
S service)
Add a service if no implementation of the given service is registered with the registry yet.
|
void |
cleanup()
Clear up the services registered, by calling
Service.cleanup() on each registered service |
void |
cleanupAfterBoot()
Clean up
BootstrapServices by calling BootstrapService.cleanupAfterBoot() on each registered
BootstrapService. |
<S extends Service> |
contains(Class<S> type)
Check if a service is registered
|
Set<Map.Entry<Class<? extends Service>,Service>> |
entrySet() |
boolean |
equals(Object obj) |
protected Map<Class<? extends Service>,Service> |
get() |
<S extends Service> |
get(Class<S> type)
Retrieve a service implementation
|
<S extends Service> |
getOptional(Class<S> type)
Retrieve a service implementation wrapped in
Optional. |
<S extends Service> |
getRequired(Class<S> type)
Retrieve a required service implementation.
|
int |
hashCode() |
Iterator<Service> |
iterator() |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic <S extends Service> void add(Class<S> type, S service)
ServiceRegistryadd in interface ServiceRegistryS - the service type to addtype - the service type to addservice - the service implementationServicepublic void addAll(Collection<Map.Entry<Class<? extends Service>,Service>> services)
ServiceRegistryaddAll in interface ServiceRegistryservices - services to be addedpublic Set<Map.Entry<Class<? extends Service>,Service>> entrySet()
entrySet in interface ServiceRegistrypublic <S extends Service> S get(Class<S> type)
ServiceRegistryget in interface ServiceRegistryS - the service typetype - the service typepublic <S extends Service> Optional<S> getOptional(Class<S> type)
ServiceRegistryOptional.getOptional in interface ServiceRegistryS - the service typetype - the service typeOptionalpublic <S extends Service> boolean contains(Class<S> type)
ServiceRegistrycontains in interface ServiceRegistryS - the service typetype - the service typepublic void cleanup()
ServiceRegistryService.cleanup() on each registered servicecleanup in interface ServiceRegistrypublic void cleanupAfterBoot()
ServiceRegistryBootstrapServices by calling BootstrapService.cleanupAfterBoot() on each registered
BootstrapService.cleanupAfterBoot in interface ServiceRegistrypublic <S extends Service> S getRequired(Class<S> type)
ServiceRegistrygetRequired in interface ServiceRegistryS - the service typetype - the service typepublic <S extends Service> S addIfAbsent(Class<S> type, S service)
ServiceRegistryaddIfAbsent in interface ServiceRegistryS - the service type to addtype - the service type to addservice - the service implementationCopyright © 2008–2017. All rights reserved.