Class DI.FactoryBuilder

java.lang.Object
org.apache.logging.log4j.plugins.di.DI.FactoryBuilder
Enclosing class:
DI

public static class DI.FactoryBuilder extends Object
Builder DSL for configuring a ConfigurableInstanceFactory using ConfigurableInstanceFactoryPostProcessor instances. This DSL is used for adding bindings to be registered before or after standard post-processor service classes have been invoked.
  • Constructor Details

  • Method Details

    • addInitialBindingFrom

      public <T> DI.UnscopedBindingBuilder<T> addInitialBindingFrom(Key<T> key)
      Begins to define a binding that will be registered before the ConfigurableInstanceFactory is initialized with service provider classes.
      Type Parameters:
      T - type of binding result being registered
      Parameters:
      key - binding key for which a binding will be registered
      Returns:
      builder DSL to specify the binding to register
    • addInitialBindingFrom

      public <T> DI.UnscopedBindingBuilder<T> addInitialBindingFrom(Class<T> type)
      Begins to define a binding that will be registered before the ConfigurableInstanceFactory is initialized with service provider classes.
      Type Parameters:
      T - type of binding result being registered
      Parameters:
      type - class for which a binding will be registered
      Returns:
      builder DSL to specify the binding to register
    • addBindingFrom

      public <T> DI.UnscopedBindingBuilder<T> addBindingFrom(Key<T> key)
      Begins to define a binding that will be registered after the ConfigurableInstanceFactory is initialized with service provider classes.
      Type Parameters:
      T - type of binding result being registered
      Parameters:
      key - binding key for which a binding will be registered
      Returns:
      builder DSL to specify the binding to register
    • addBindingFrom

      public <T> DI.UnscopedBindingBuilder<T> addBindingFrom(Class<T> type)
      Begins to define a binding that will be registered after the ConfigurableInstanceFactory is initialized with service provider classes.
      Type Parameters:
      T - type of binding result being registered
      Parameters:
      type - class for which a binding will be registered
      Returns:
      builder DSL to specify the binding to register
    • addInitialBundle

      public DI.FactoryBuilder addInitialBundle(Object bundle)
      Adds a bundle class or instance to be registered before the ConfigurableInstanceFactory is initialized with service provider classes.
      Parameters:
      bundle - bundle class or instance to register
      Returns:
      this builder DSL
    • addBundle

      public DI.FactoryBuilder addBundle(Object bundle)
      Adds a bundle class or instance to be registered after the ConfigurableInstanceFactory is initialized with service provider classes.
      Parameters:
      bundle - bundle class or instance to register
      Returns:
      this builder DSL
    • build

      Constructs and configures a ConfigurableInstanceFactory using the configured bindings before and after service provider initialization. All initial bindings are registered before invoking the ConfigurableInstanceFactoryPostProcessor service providers, and then the remaining bindings are registered.
      Returns:
      the initialized ConfigurableInstanceFactory
    • copy

      public DI.FactoryBuilder copy()
      Creates a new builder DSL with a copy of the configured bindings from this builder.
      Returns:
      copy of this builder