ConfigurableDI

class ConfigurableDI : DI

A class that can be used to configure a DI object and as a DI object.

If you want it to be mutable, the mutable property needs to be set before any dependency retrieval. The non-mutable configuration methods (addImport, addExtend & addConfig) needs to happen before any dependency retrieval.

Constructors

ConfigurableDI
Link copied to clipboard
fun ConfigurableDI()
Default constructor.
ConfigurableDI
Link copied to clipboard
fun ConfigurableDI(mutable: Boolean)
Convenient constructor to directly set the mutability.

Functions

addConfig
Link copied to clipboard
fun addConfig(config: DI.MainBuilder.() -> Unit)
Adds a configuration to the bindings that will be applied when the DI is constructed.
addExtend
Link copied to clipboard
fun addExtend(di: DI, allowOverride: Boolean = false)
Adds the bindings of an existing DI instance to the bindings that will be applied when the DI is constructed.
addImport
Link copied to clipboard
fun addImport(module: DI.Module, allowOverride: Boolean = false)
Adds a module to the bindings that will be applied when the DI is constructed.
clear
Link copied to clipboard
fun clear()
Clear all the bindings of the DI instance.
getOrConstruct
Link copied to clipboard
fun getOrConstruct(): DI
Get the DI instance if it has already been constructed, or construct it if not.

Properties

canConfigure
Link copied to clipboard
val canConfigure: Boolean
Whether or not this DI can be configured (meaning that it has not been used for retrieval yet).
diContext
Link copied to clipboard
open val diContext: DIContext<*>
diTrigger
Link copied to clipboard
open val diTrigger: DITrigger?
mutable
Link copied to clipboard
var mutable: Boolean? = null
Whether this Configurabledi can be mutated.