DI
KOtlin DEpendency INjection.
To construct a DI instance, simply use it's block constructor and define your bindings in it :
val di = DI {
bind<Dice>() with factory { sides: Int -> RandomDice(sides) }
bind<DataSource>() with singleton { SqliteDS.open("path/to/file") }
bind<Random>() with provider { SecureRandom() }
constant("answer") with "forty-two"
}Inheritors
Types
Base builder DSL interface that allows to define scoped and context bindings.
Allows for the DSL inside the block argument of the constructor of DI and DI.Module.
Exception thrown when there is a dependency loop.
Builder to create a DI object.
Exception thrown when searching for bindings and none could be found.
Exception thrown when asked for a dependency that cannot be found.
Exception thrown when there is an overriding error.
Functions
Gets a factory of T for the given argument type, return type and tag, or nul if none is found.
Gets an instance of T for the given type and tag, or null if none is found.
Allows to create a new instance of an unbound object with the same API as when bounding one.
Gets a provider of T for the given type and tag, or null if none is found.
Gets a provider of T for the given type and tag, or null if none is found.