Interface ScopeConfiguration


  • public interface ScopeConfiguration
    Provides the capability to inject additional services and instances into a scope
    Author:
    cdivilly
  • <section role="region">
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      ScopeConfiguration add​(java.lang.Class<?> service)
      Add the specified type as a service provider in this scope
      default ScopeConfiguration add​(java.lang.Class<?> type, java.lang.Object impl)
      Add an instance of the specified service
      default ScopeConfiguration add​(java.lang.Iterable<java.lang.Class<?>> services)
      Add the specified types as service providers in this scope
      ScopeConfiguration add​(TypeQualifier<?> provides, java.lang.Object impl)
      Add an instance of the specified service
      ScopeConfiguration ignore​(java.lang.Class<?> type)
      Ensure that all providers of the specified service type are ignored in this scope.
      default ScopeConfiguration named​(java.util.Map<java.lang.String,​java.lang.Object> namedAttributes)
      Add the specified object instances, each of which will be constrained with a Named constraint.
      ScopeConfiguration onClose​(java.lang.Runnable onClose)
      Configure a task to be run when this scope is closed.
      default ScopeConfiguration set​(java.lang.Class<?> provides, java.lang.Object impl)
      Set the sole implementation of the specified service to be the specified instance.
      ScopeConfiguration set​(TypeQualifier<?> provides, java.lang.Object impl)
      Set the sole implementation of the specified service to be the specified instance.
    </section>
  • <section role="region">
    • Method Detail

      • add

        ScopeConfiguration add​(java.lang.Class<?> service)
        Add the specified type as a service provider in this scope
        Parameters:
        service - The service provider type
        Returns:
        self
      • add

        default ScopeConfiguration add​(java.lang.Iterable<java.lang.Class<?>> services)
        Add the specified types as service providers in this scope
        Parameters:
        services - Set of service provider types
        Returns:
        self
      • add

        default ScopeConfiguration add​(java.lang.Class<?> type,
                                       java.lang.Object impl)
        Add an instance of the specified service
        Parameters:
        type - The type of the service provided
        impl - The instance of the service
        Returns:
        self
      • add

        ScopeConfiguration add​(TypeQualifier<?> provides,
                               java.lang.Object impl)
        Add an instance of the specified service
        Parameters:
        provides - The qualified service that the instance provides
        impl - The instance of the service
        Returns:
        self
      • ignore

        ScopeConfiguration ignore​(java.lang.Class<?> type)
        Ensure that all providers of the specified service type are ignored in this scope. This facility can be used to constrain the types of services available in a scope.
        Parameters:
        type - The type of the service to ignore
        Returns:
        self
      • named

        default ScopeConfiguration named​(java.util.Map<java.lang.String,​java.lang.Object> namedAttributes)
        Add the specified object instances, each of which will be constrained with a Named constraint. Each attribute will be bound to offer it's own type (the value returned by getClass()) as the service that it offers.
        Parameters:
        namedAttributes - Map of String keys to Object instances. The key will be bound to a Named TypeQualifier, whose type will be the value returned by the objects's Object.getClass() method
        Returns:
        self
      • onClose

        ScopeConfiguration onClose​(java.lang.Runnable onClose)
        Configure a task to be run when this scope is closed. Typically this task will cleanup/release any resources associated with the scope
        Parameters:
        onClose - The task to perform when the scope is closed
        Returns:
        self
      • set

        default ScopeConfiguration set​(java.lang.Class<?> provides,
                                       java.lang.Object impl)
        Set the sole implementation of the specified service to be the specified instance. Replaces all existing providers of the service
        Parameters:
        provides - The service being provided
        impl - The instance that provides the service
        Returns:
        self
      • set

        ScopeConfiguration set​(TypeQualifier<?> provides,
                               java.lang.Object impl)
        Set the sole implementation of the specified service to be the specified instance. Replaces all existing providers of the service
        Parameters:
        provides - The service being provided
        impl - The implementation
        Returns:
        self
    </section>