public interface ServiceRegistry extends Iterable<Service>
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
BootstrapService s 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() |
<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.
|
forEach, iterator, spliterator
<S extends Service> void add(Class<S> type, S service)
S
- the service type to addtype
- the service type to addservice
- the service implementationService
<S extends Service> S addIfAbsent(Class<S> type, S service)
S
- the service type to addtype
- the service type to addservice
- the service implementationvoid addAll(Collection<Map.Entry<Class<? extends Service>,Service>> services)
services
- services to be added<S extends Service> S get(Class<S> type)
S
- the service typetype
- the service type<S extends Service> Optional<S> getOptional(Class<S> type)
Optional
.S
- the service typetype
- the service typeOptional
<S extends Service> S getRequired(Class<S> type)
S
- the service typetype
- the service typeIllegalStateException
- if the service is not available<S extends Service> boolean contains(Class<S> type)
S
- the service typetype
- the service typevoid cleanup()
Service.cleanup()
on each registered servicevoid cleanupAfterBoot()
BootstrapService
s by calling BootstrapService.cleanupAfterBoot()
on each registered
BootstrapService
.Copyright © 2008–2017. All rights reserved.