Package org.jboss.msc.service
Class DelegatingServiceBuilder<T>
java.lang.Object
org.jboss.msc.service.DelegatingServiceBuilder<T>
- Type Parameters:
T- the service type
- All Implemented Interfaces:
ServiceBuilder<T>
- Direct Known Subclasses:
AsyncServiceBuilder
A service builder which delegates to another service builder.
- Author:
- David M. Lloyd, Richard Opalka
-
Constructor Summary
ConstructorsConstructorDescriptionDelegatingServiceBuilder(ServiceBuilder<T> delegate) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionaddAliases(ServiceName... aliases) Deprecated.<I> ServiceBuilder<T>addDependency(ServiceName dependency, Class<I> type, Injector<I> target) Deprecated.addListener(LifecycleListener listener) Adds a service listener to be added to the service.addMonitor(StabilityMonitor monitor) Deprecated.protected ServiceBuilder<T>Get the ServiceBuilder delegate.install()Installs configured service into the container.<V> Consumer<V>provides(ServiceName... names) Specifies value provided by service.<V> Supplier<V>requires(ServiceName name) Specifies value name required by service.Sets initial service mode.setInstance(Service service) Sets service instance.
-
Constructor Details
-
DelegatingServiceBuilder
Construct a new instance.- Parameters:
delegate- the builder to delegate to
-
-
Method Details
-
getDelegate
Get the ServiceBuilder delegate.- Returns:
- ServiceBuilder delegate
-
requires
Specifies value name required by service. There can be multiple values service may depend on.- Specified by:
requiresin interfaceServiceBuilder<T>- Type Parameters:
V- required dependency value type- Parameters:
name- required dependency name- Returns:
- readonly dependency reference
-
provides
Specifies value provided by service. There can be multiple names for the same value. At least onenameparameter must be provided to this method. If there are morenamesin the vararg array then the first one is called provided value name and other are called provided value aliases.- Specified by:
providesin interfaceServiceBuilder<T>- Type Parameters:
V- provided value type- Parameters:
names- provided value name (and its aliases)- Returns:
- writable dependency reference
-
setInitialMode
Sets initial service mode.- Specified by:
setInitialModein interfaceServiceBuilder<T>- Parameters:
mode- initial service mode- Returns:
- this builder
-
setInstance
Sets service instance. IfServiceBuilder.install()method call is issued without this method being called thenNULLservice will be installed into the container.Once this method have been called then all subsequent calls of
ServiceBuilder.requires(ServiceName), andServiceBuilder.provides(ServiceName...)methods will fail because their return values should be provided to service instance.- Specified by:
setInstancein interfaceServiceBuilder<T>- Parameters:
service- the service instance- Returns:
- this configurator
-
addListener
Adds a service listener to be added to the service.- Specified by:
addListenerin interfaceServiceBuilder<T>- Parameters:
listener- the listener to add to the service- Returns:
- this builder
-
install
Installs configured service into the container.- Specified by:
installin interfaceServiceBuilder<T>- Returns:
- installed service controller
-
addAliases
Deprecated.Adds aliases for this service.- Specified by:
addAliasesin interfaceServiceBuilder<T>- Parameters:
aliases- the service names to use as aliases- Returns:
- the builder
-
addDependency
@Deprecated public <I> ServiceBuilder<T> addDependency(ServiceName dependency, Class<I> type, Injector<I> target) Deprecated.Add a service dependency. The type of the dependency is checked before it is passed into the (type-safe) injector instance. Calling this method multiple times for the same service name will only add it as a dependency one time; however this may be useful to specify multiple injections for one dependency.- Specified by:
addDependencyin interfaceServiceBuilder<T>- Type Parameters:
I- the type of the value of the dependency- Parameters:
dependency- the name of the dependencytype- the class of the value of the dependencytarget- the injector into which the dependency should be stored- Returns:
- this builder
-
addMonitor
Deprecated.Adds a stability monitor to be added to the service.- Specified by:
addMonitorin interfaceServiceBuilder<T>- Parameters:
monitor- the monitor to add to the service- Returns:
- this builder
-