Main Builder
Builder to create a DI object.
Properties
Every methods eventually ends up to a call to this builder.
The context type that will be used by all bindings that are defined in this DSL context.
The external source is repsonsible for fetching / creating a value when DI cannot find a matching binding.
If true, NotFoundException thrown will contain the list of all the bindings available.
If true, exceptions thrown will contain qualified names.
Functions
Defines that the binding will be saved in a set binding.
Starts a direct binding with a given tag. A direct bind does not define the type to be bound, the type will be defined according to the bound factory.
Attaches the binding of a given type with a given tag.
Starts the binding of a given type with a given tag.
Starts the binding of a given type with a given tag.
Attaches a binding to the DI container
Creates a set: multiple bindings can be added in this set.
Creates a set and add multiple bindings to it.
Binds a constant provider: will always return the given instance.
Binds an eager singleton: will create an instance as soon as kodein is ready (all bindings are set) and will always return this instance.
Binds an instance provider: will always return the given instance.
Creates a factory: each time an instance is needed, the function creator function will be called.
Creates a factory: each time an instance is needed, the function constructor function will be called.
Creates a set: multiple bindings can be added in this set.
Creates a set and add multiple bindings to it.
Binds a singleton: will create an instance on first request and will subsequently always return the same instance.
Binds a singleton: will create an instance on first request and will subsequently always return the same instance.
Starts a constant binding.
Used to define bindings with a context: bind<MyType>() with contexted<MyContext>().provider { /*...*/ }
Delegate the targeted type to a new binding type
Creates an eager singleton: will create an instance as soon as kodein is ready (all bindings are set) and will always return this instance.
Like import but checks that will only import each module once.
Add multiple bindings in an existing set
Creates an instance provider: will always return the given instance.
Creates a multiton: will create an instance on first request for each different argument and will subsequently always return the same instance for the same argument.
Used to define bindings with a scope: bind<MyType>() with scoped(myScope).singleton { /*...*/ }