Class Instances.Builder

java.lang.Object
oracle.dbtools.plugin.api.di.Instances.Builder
All Implemented Interfaces:
InstanceLocator
Enclosing class:
Instances

public static class Instances.Builder extends Object implements InstanceLocator
Build Instances instances
Author:
cdivilly
  • Method Details

    • add

      public <T> Instances.Builder add(Class<T> service, T instance)
      Add an instance of a service
      Type Parameters:
      T - The type of the service
      Parameters:
      service - The type of the service
      instance - The implementation of the service
      Returns:
      self
    • add

      public <T> Instances.Builder add(TypeQualifier<T> service, T instance)
      Add an instance of a service
      Type Parameters:
      T - The type of the service
      Parameters:
      service - The qualified service type
      instance - The implementation of the service
      Returns:
      self
    • build

      public Instances build()
      Build the Instances instance
      Returns:
      Immutable Instances instance
    • clear

      public Instances.Builder clear()
      Clear all instances
      Returns:
      self
    • merge

      public Instances.Builder merge(Instances other, boolean overwrite)
      Merge the specified set of instances into this set, overwriting any existing instances with the specified values
      Parameters:
      other - The values to merge into the set
      overwrite - Determines the merging behavior. If true then existing matches are replaced with the specified values, if false, existing values are retained, only values not already present are added
      Returns:
      self
    • remove

      public Instances.Builder remove(Class<?> type)
      Remove all providers of the specified type
      Parameters:
      type - The service type to remove
      Returns:
      self
    • remove

      public <T> Instances.Builder remove(TypeQualifier<T> service)
      Remove all providers of the specified service
      Type Parameters:
      T - The type of the service
      Parameters:
      service - The qualified service
      Returns:
      self
    • select

      public <T> InstanceProvider<T> select(TypeQualifier<T> service)
      Description copied from interface: InstanceLocator
      Select all services matching the specified TypeQualifier
      Specified by:
      select in interface InstanceLocator
      Type Parameters:
      T - The type of the service to locate
      Parameters:
      service - The qualifier that constrains which implementation to match
      Returns:
      InstanceProvider for the specified type and qualifier. This value is never null.
    • set

      public <T> Instances.Builder set(Class<T> service, T instance)
      Set the sole provider of the specified service
      Type Parameters:
      T - The type of the service
      Parameters:
      service - The type of the service
      instance - The implementation of the service
      Returns:
      self
    • set

      public Instances.Builder set(TypeQualifier<?> service, InstanceProvider<?> provider)
      Set the sole InstanceProvider for the specified service
      Parameters:
      service - The qualified service
      provider - The provider of the service
      Returns:
      self
    • set

      public <T> Instances.Builder set(TypeQualifier<T> qualifier, T instance)
      Set the sole implementation of the specified service
      Type Parameters:
      T - The type of the service
      Parameters:
      qualifier - The qualified service
      instance - The implementation of the service
      Returns:
      self
    • toString

      public String toString()
      Overrides:
      toString in class Object