Builder

interface Builder

This is where you configure the bindings.

Parameters

allowOverride

Whether or not the bindings defined by this builder or its imports are allowed to explicitly override existing bindings.

silentOverride

Whether or not the bindings defined by this builder or its imports are allowed to silently override existing bindings.

bindingsMap

The map that contains the bindings. Can be set at construction to construct a sub-builder (with different override permissions).

Functions

bind
Link copied to clipboard
abstract fun <C : Any, A, T : Any> bind(key: DI.Key<C, A, T>, binding: DIBinding<in C, in A, out T>, fromModule: String? = null, overrides: Boolean? = null)

Binds the given key to the given binding.

extend
Link copied to clipboard
abstract fun extend(container: DIContainer, allowOverride: Boolean = false, copy: Set<DI.Key<*, *, *>> = emptySet())

Imports all bindings defined in the given DIContainer into this builder.

onReady
Link copied to clipboard
abstract fun onReady(cb: DirectDI.() -> Unit)

Adds a callback that will be called once the DI object has been initialized.

registerContextTranslator
Link copied to clipboard
abstract fun registerContextTranslator(translator: ContextTranslator<*, *>)
subBuilder
Link copied to clipboard
abstract fun subBuilder(allowOverride: Boolean = false, silentOverride: Boolean = false): DIContainer.Builder

Creates a sub builder that will register its bindings to the same map.