Class DI.FactoryBuilder
java.lang.Object
org.apache.logging.log4j.plugins.di.DI.FactoryBuilder
- Enclosing class:
- DI
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 Summary
ConstructorsConstructorDescriptionConstructs a fresh builder DSL usingDefaultInstanceFactory
and all availableConfigurableInstanceFactoryPostProcessor
service provider classes in sorted order. -
Method Summary
Modifier and TypeMethodDescription<T> DI.UnscopedBindingBuilder<T>
addBindingFrom
(Class<T> type) Begins to define a binding that will be registered after theConfigurableInstanceFactory
is initialized with service provider classes.<T> DI.UnscopedBindingBuilder<T>
addBindingFrom
(Key<T> key) Begins to define a binding that will be registered after theConfigurableInstanceFactory
is initialized with service provider classes.Adds a bundle class or instance to be registered after theConfigurableInstanceFactory
is initialized with service provider classes.<T> DI.UnscopedBindingBuilder<T>
addInitialBindingFrom
(Class<T> type) Begins to define a binding that will be registered before theConfigurableInstanceFactory
is initialized with service provider classes.<T> DI.UnscopedBindingBuilder<T>
addInitialBindingFrom
(Key<T> key) Begins to define a binding that will be registered before theConfigurableInstanceFactory
is initialized with service provider classes.addInitialBundle
(Object bundle) Adds a bundle class or instance to be registered before theConfigurableInstanceFactory
is initialized with service provider classes.build()
Constructs and configures aConfigurableInstanceFactory
using the configured bindings before and after service provider initialization.copy()
Creates a new builder DSL with a copy of the configured bindings from this builder.
-
Constructor Details
-
FactoryBuilder
public FactoryBuilder()Constructs a fresh builder DSL usingDefaultInstanceFactory
and all availableConfigurableInstanceFactoryPostProcessor
service provider classes in sorted order.
-
-
Method Details
-
addInitialBindingFrom
Begins to define a binding that will be registered before theConfigurableInstanceFactory
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
Begins to define a binding that will be registered before theConfigurableInstanceFactory
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
Begins to define a binding that will be registered after theConfigurableInstanceFactory
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
Begins to define a binding that will be registered after theConfigurableInstanceFactory
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
Adds a bundle class or instance to be registered before theConfigurableInstanceFactory
is initialized with service provider classes.- Parameters:
bundle
- bundle class or instance to register- Returns:
- this builder DSL
-
addBundle
Adds a bundle class or instance to be registered after theConfigurableInstanceFactory
is initialized with service provider classes.- Parameters:
bundle
- bundle class or instance to register- Returns:
- this builder DSL
-
build
Constructs and configures aConfigurableInstanceFactory
using the configured bindings before and after service provider initialization. All initial bindings are registered before invoking theConfigurableInstanceFactoryPostProcessor
service providers, and then the remaining bindings are registered.- Returns:
- the initialized ConfigurableInstanceFactory
-
copy
Creates a new builder DSL with a copy of the configured bindings from this builder.- Returns:
- copy of this builder
-