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

Link copied to clipboard
constructor()

Default constructor.

constructor(mutable: Boolean)

Convenient constructor to directly set the mutability.

Properties

Link copied to clipboard

Whether or not this DI can be configured (meaning that it has not been used for retrieval yet).

Link copied to clipboard
open val diContext: DIContext<*>
Link copied to clipboard
open val diTrigger: DITrigger?
Link copied to clipboard

Whether this Configurabledi can be mutated.

Functions

Link copied to clipboard
fun addConfig(config: DI.MainBuilder.() -> Unit): ConfigurableDI

Adds a configuration to the bindings that will be applied when the DI is constructed.

Link copied to clipboard
fun addExtend(di: DI, allowOverride: Boolean = false, copy: Copy = Copy.NonCached): ConfigurableDI

Adds the bindings of an existing DI instance to the bindings that will be applied when the DI is constructed.

Link copied to clipboard
fun addImport(module: DI.Module, allowOverride: Boolean = false): ConfigurableDI

Adds a module to the bindings that will be applied when the DI is constructed.

Link copied to clipboard
fun clear()

Clear all the bindings of the DI instance. Needs mutable to be true.

Link copied to clipboard
fun getOrConstruct(): DI

Get the DI instance if it has already been constructed, or construct it if not.