Class ForwardingServiceRegistry
- java.lang.Object
-
- org.jboss.weld.bootstrap.api.helpers.ForwardingServiceRegistry
-
- All Implemented Interfaces:
Iterable<Service>
,ServiceRegistry
public abstract class ForwardingServiceRegistry extends Object implements ServiceRegistry
-
-
Constructor Summary
Constructors Constructor Description ForwardingServiceRegistry()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <S extends Service>
voidadd(Class<S> type, S service)
Add a servicevoid
addAll(Collection<Map.Entry<Class<? extends Service>,Service>> services)
Add services<S extends Service>
SaddIfAbsent(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 callingService.cleanup()
on each registered servicevoid
cleanupAfterBoot()
Clean upBootstrapService
s by callingBootstrapService.cleanupAfterBoot()
on each registeredBootstrapService
.<S extends Service>
booleancontains(Class<S> type)
Check if a service is registeredprotected abstract ServiceRegistry
delegate()
Set<Map.Entry<Class<? extends Service>,Service>>
entrySet()
<S extends Service>
Sget(Class<S> type)
Retrieve a service implementation<S extends Service>
Optional<S>getOptional(Class<S> type)
Retrieve a service implementation wrapped inOptional
.<S extends Service>
SgetRequired(Class<S> type)
Retrieve a required service implementation.Iterator<Service>
iterator()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
delegate
protected abstract ServiceRegistry delegate()
-
add
public <S extends Service> void add(Class<S> type, S service)
Description copied from interface:ServiceRegistry
Add a service- Specified by:
add
in interfaceServiceRegistry
- Type Parameters:
S
- the service type to add- Parameters:
type
- the service type to addservice
- the service implementation- See Also:
Service
-
contains
public <S extends Service> boolean contains(Class<S> type)
Description copied from interface:ServiceRegistry
Check if a service is registered- Specified by:
contains
in interfaceServiceRegistry
- Type Parameters:
S
- the service type- Parameters:
type
- the service type- Returns:
- true if a service is registered, otherwise false
-
get
public <S extends Service> S get(Class<S> type)
Description copied from interface:ServiceRegistry
Retrieve a service implementation- Specified by:
get
in interfaceServiceRegistry
- Type Parameters:
S
- the service type- Parameters:
type
- the service type- Returns:
- the service implementation, or null if none is registered
-
getOptional
public <S extends Service> Optional<S> getOptional(Class<S> type)
Description copied from interface:ServiceRegistry
Retrieve a service implementation wrapped inOptional
.- Specified by:
getOptional
in interfaceServiceRegistry
- Type Parameters:
S
- the service type- Parameters:
type
- the service type- Returns:
- the service implementation wrapped within
Optional
-
addAll
public void addAll(Collection<Map.Entry<Class<? extends Service>,Service>> services)
Description copied from interface:ServiceRegistry
Add services- Specified by:
addAll
in interfaceServiceRegistry
- Parameters:
services
- services to be added
-
entrySet
public Set<Map.Entry<Class<? extends Service>,Service>> entrySet()
- Specified by:
entrySet
in interfaceServiceRegistry
-
cleanup
public void cleanup()
Description copied from interface:ServiceRegistry
Clear up the services registered, by callingService.cleanup()
on each registered service- Specified by:
cleanup
in interfaceServiceRegistry
-
cleanupAfterBoot
public void cleanupAfterBoot()
Description copied from interface:ServiceRegistry
Clean upBootstrapService
s by callingBootstrapService.cleanupAfterBoot()
on each registeredBootstrapService
.- Specified by:
cleanupAfterBoot
in interfaceServiceRegistry
-
getRequired
public <S extends Service> S getRequired(Class<S> type)
Description copied from interface:ServiceRegistry
Retrieve a required service implementation. Throws an exception if the service is not available- Specified by:
getRequired
in interfaceServiceRegistry
- Type Parameters:
S
- the service type- Parameters:
type
- the service type- Returns:
- the service implementation
-
addIfAbsent
public <S extends Service> S addIfAbsent(Class<S> type, S service)
Description copied from interface:ServiceRegistry
Add a service if no implementation of the given service is registered with the registry yet. Returns null if the given service was added. Otherwise, the previous service implementation is returned.- Specified by:
addIfAbsent
in interfaceServiceRegistry
- Type Parameters:
S
- the service type to add- Parameters:
type
- the service type to addservice
- the service implementation- Returns:
- null if no service implementation was previously associated with the given service. Otherwise, the previous service implementation is returned.
-
-