Interface ServiceDependency<V>

All Superinterfaces:
Consumer<org.jboss.as.controller.RequirementServiceBuilder<?>>, Dependency<org.jboss.as.controller.RequirementServiceBuilder<?>,V>, Supplier<V>
All Known Implementing Classes:
ServiceDependency.AbstractServiceDependency, ServiceDependency.DefaultServiceDependency, ServiceDependency.SimpleServiceDependency, ServiceDependency.SuppliedServiceDependency

public interface ServiceDependency<V> extends Dependency<org.jboss.as.controller.RequirementServiceBuilder<?>,V>
Encapsulates a dependency on a Service that supplies a value.
Author:
Paul Ferraro
  • Method Details

    • andThen

      default ServiceDependency<V> andThen(Consumer<? super org.jboss.as.controller.RequirementServiceBuilder<?>> after)
      Specified by:
      andThen in interface Consumer<V>
      Specified by:
      andThen in interface Dependency<org.jboss.as.controller.RequirementServiceBuilder<?>,V>
    • map

      default <R> ServiceDependency<R> map(Function<V,R> mapper)
      Description copied from interface: Dependency
      Returns a dependency whose value is the result of applying the specified mapping function.
      Specified by:
      map in interface Dependency<org.jboss.as.controller.RequirementServiceBuilder<?>,V>
      Type Parameters:
      R - the mapped value type
      Parameters:
      mapper - a mapping function
      Returns:
      a dependency whose value is the result of applying the specified mapping function.
    • combine

      default <T, R> ServiceDependency<R> combine(Dependency<org.jboss.as.controller.RequirementServiceBuilder<?>,T> dependency, BiFunction<V,T,R> mapper)
      Description copied from interface: Dependency
      Returns a dependency that combines this dependency with the specified dependency, whose value is determined by the specified mapping function.
      Specified by:
      combine in interface Dependency<org.jboss.as.controller.RequirementServiceBuilder<?>,V>
      Type Parameters:
      T - the other dependency type
      R - the mapped value type
      Parameters:
      dependency - another dependency
      mapper - a mapping function
      Returns:
      a dependency that combines this dependency with the specified dependency, whose value is determined by the specified mapping function.
    • empty

      static <V> ServiceDependency<V> empty()
      Returns an empty pseudo-dependency whose Supplier.get() returns null.
      Type Parameters:
      V - the value type
      Returns:
      an empty service dependency
    • of

      static <V> ServiceDependency<V> of(V value)
      Returns a pseudo-dependency whose Supplier.get() returns the specified value.
      Type Parameters:
      V - the value type
      Parameters:
      value - a service value
      Returns:
      a pseudo-dependency whose Supplier.get() returns the specified value.
    • from

      static <V> ServiceDependency<V> from(Supplier<V> supplier)
      Returns a pseudo-dependency whose Supplier.get() returns the value from the specified supplier.
      Type Parameters:
      V - the value type
      Parameters:
      factory - a service value supplier
      Returns:
      a pseudo-dependency whose Supplier.get() returns the value from the specified supplier.
      Throws:
      NullPointerException - if supplier was null
    • on

      static <T> ServiceDependency<T> on(ServiceName name)
      Returns a dependency on the service with the specified name.
      Type Parameters:
      T - the dependency type
      Parameters:
      name - a service name
      Returns:
      a service dependency
    • from

      static <T> ServiceDependency<T> from(ServiceDependency<T> dependency)
      Type Parameters:
      T - the dependency type
      Returns:
      a service dependency
      Throws:
      NullPointerException - if dependency was null
    • on

      static <T> ServiceDependency<T> on(String capabilityName, Class<T> type, String... referenceNames)
      Returns a dependency on the capability with the specified name and type, resolved against the specified references names. This method is provided for migration purposes. Users should prefer ServiceDescriptor-based variants of this method whenever possible.
      Type Parameters:
      T - the dependency type
      Parameters:
      capabilityName - the name of the referenced capability
      type - the service type of the referenced capability
      referenceNames - the reference names
      Returns:
      a service dependency
    • on

      static <T> ServiceDependency<T> on(NullaryServiceDescriptor<T> descriptor)
      Returns a dependency on the specified capability.
      Type Parameters:
      T - the dependency type
      Parameters:
      descriptor - the descriptor for the required service
      Returns:
      a service dependency
    • on

      static <T> ServiceDependency<T> on(UnaryServiceDescriptor<T> descriptor, String name)
      Returns a dependency on the specified unary capability, resolved against the specified reference name.
      Type Parameters:
      T - the dependency type
      Parameters:
      descriptor - the descriptor for the required service
      name - the reference name
      Returns:
      a service dependency
    • on

      static <T> ServiceDependency<T> on(BinaryServiceDescriptor<T> descriptor, String parentName, String childName)
      Returns a dependency on the specified binary capability, resolved against the specified reference names.
      Type Parameters:
      T - the dependency type
      Parameters:
      descriptor - the descriptor for the required service
      parentName - the parent reference name
      childName - the child reference name
      Returns:
      a service dependency
    • on

      static <T> ServiceDependency<T> on(TernaryServiceDescriptor<T> descriptor, String grandparentName, String parentName, String childName)
      Returns a dependency on the specified ternary capability, resolved against the specified reference names.
      Type Parameters:
      T - the dependency type
      Parameters:
      descriptor - the descriptor for the required service
      grandparentName - the grandparentName reference name
      parentName - the parent reference name
      childName - the child reference name
      Returns:
      a service dependency
    • on

      static <T> ServiceDependency<T> on(QuaternaryServiceDescriptor<T> descriptor, String ancestorName, String grandparentName, String parentName, String childName)
      Returns a dependency on the specified quaternary capability, resolved against the specified reference names.
      Type Parameters:
      T - the dependency type
      Parameters:
      descriptor - the descriptor for the required service
      ancestorName - the ancestor reference name
      grandparentName - the grandparent reference name
      parentName - the parent reference name
      childName - the child reference name
      Returns:
      a service dependency