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

public class DelegatingServiceBuilder<T> extends Object implements ServiceBuilder<T>
A service builder which delegates to another service builder.
Author:
David M. Lloyd, Richard Opalka
  • Constructor Details

    • DelegatingServiceBuilder

      public DelegatingServiceBuilder(ServiceBuilder<T> delegate)
      Construct a new instance.
      Parameters:
      delegate - the builder to delegate to
  • Method Details

    • getDelegate

      protected ServiceBuilder<T> getDelegate()
      Get the ServiceBuilder delegate.
      Returns:
      ServiceBuilder delegate
    • requires

      public <V> Supplier<V> requires(ServiceName name)
      Specifies value name required by service. There can be multiple values service may depend on.
      Specified by:
      requires in interface ServiceBuilder<T>
      Type Parameters:
      V - required dependency value type
      Parameters:
      name - required dependency name
      Returns:
      readonly dependency reference
    • provides

      public <V> Consumer<V> provides(ServiceName... names)
      Specifies value provided by service. There can be multiple names for the same value. At least one name parameter must be provided to this method. If there are more names in the vararg array then the first one is called provided value name and other are called provided value aliases.
      Specified by:
      provides in interface ServiceBuilder<T>
      Type Parameters:
      V - provided value type
      Parameters:
      names - provided value name (and its aliases)
      Returns:
      writable dependency reference
    • setInitialMode

      public ServiceBuilder<T> setInitialMode(ServiceController.Mode mode)
      Sets initial service mode.
      Specified by:
      setInitialMode in interface ServiceBuilder<T>
      Parameters:
      mode - initial service mode
      Returns:
      this builder
    • setInstance

      public ServiceBuilder<T> setInstance(Service service)
      Sets service instance. If ServiceBuilder.install() method call is issued without this method being called then NULL service will be installed into the container.

      Once this method have been called then all subsequent calls of ServiceBuilder.requires(ServiceName), and ServiceBuilder.provides(ServiceName...) methods will fail because their return values should be provided to service instance.

      Specified by:
      setInstance in interface ServiceBuilder<T>
      Parameters:
      service - the service instance
      Returns:
      this configurator
    • addListener

      public ServiceBuilder<T> addListener(LifecycleListener listener)
      Adds a service listener to be added to the service.
      Specified by:
      addListener in interface ServiceBuilder<T>
      Parameters:
      listener - the listener to add to the service
      Returns:
      this builder
    • install

      public ServiceController<T> install()
      Installs configured service into the container.
      Specified by:
      install in interface ServiceBuilder<T>
      Returns:
      installed service controller
    • addAliases

      @Deprecated public ServiceBuilder<T> addAliases(ServiceName... aliases)
      Deprecated.
      Adds aliases for this service.
      Specified by:
      addAliases in interface ServiceBuilder<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:
      addDependency in interface ServiceBuilder<T>
      Type Parameters:
      I - the type of the value of the dependency
      Parameters:
      dependency - the name of the dependency
      type - the class of the value of the dependency
      target - the injector into which the dependency should be stored
      Returns:
      this builder
    • addMonitor

      @Deprecated public ServiceBuilder<T> addMonitor(StabilityMonitor monitor)
      Deprecated.
      Adds a stability monitor to be added to the service.
      Specified by:
      addMonitor in interface ServiceBuilder<T>
      Parameters:
      monitor - the monitor to add to the service
      Returns:
      this builder