MainBuilder

interface MainBuilder : DI.Builder

Builder to create a DI object.

Functions

Bind
Link copied to clipboard
common
abstract fun Bind(tag: Any? = null, overrides: Boolean? = null): DI.Builder.DirectBinder

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.

abstract fun <T : Any> Bind(tag: Any? = null, overrides: Boolean? = null, binding: DIBinding<*, *, T>)

Attaches the binding of a given type with a given tag.

abstract fun <T : Any> Bind(type: TypeToken<out T>, tag: Any? = null, overrides: Boolean? = null): DI.Builder.TypeBinder<T>

Starts the binding of a given type with a given tag.

BindSet
Link copied to clipboard
common
abstract fun <T : Any> BindSet(tag: Any? = null, overrides: Boolean? = null, binding: DIBinding<*, *, T>)

Attaches the binding of a given type with a given tag.

constant
Link copied to clipboard
common
abstract fun constant(tag: Any, overrides: Boolean? = null): DI.Builder.ConstantBinder

Starts a constant binding.

extend
Link copied to clipboard
common
abstract fun extend(di: DI, allowOverride: Boolean = false, copy: Copy = Copy.NonCached)
abstract fun extend(directDI: DirectDI, allowOverride: Boolean = false, copy: Copy = Copy.NonCached)

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

import
Link copied to clipboard
common
abstract fun import(module: DI.Module, allowOverride: Boolean = false)

Imports all bindings defined in the given DI.Module into this builder's definition.

importAll
Link copied to clipboard
common
abstract fun importAll(vararg modules: DI.Module, allowOverride: Boolean = false)
abstract fun importAll(modules: Iterable<DI.Module>, allowOverride: Boolean = false)

Imports all bindings defined in the given DI.Modules into this builder's definition.

importOnce
Link copied to clipboard
common
abstract fun importOnce(module: DI.Module, allowOverride: Boolean = false)

Like import but checks that will only import each module once.

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

Adds a callback that will be called once the DI object is configured and instantiated.

RegisterContextTranslator
Link copied to clipboard
common
abstract fun RegisterContextTranslator(translator: ContextTranslator<*, *>)

Properties

containerBuilder
Link copied to clipboard
common
abstract val containerBuilder: DIContainer.Builder

Every methods eventually ends up to a call to this builder.

contextType
Link copied to clipboard
common
abstract val contextType: TypeToken<Any>

The context type that will be used by all bindings that are defined in this DSL context.

explicitContext
Link copied to clipboard
common
abstract val explicitContext: Boolean
externalSources
Link copied to clipboard
common
abstract val externalSources: MutableList<ExternalSource>

The external source is repsonsible for fetching / creating a value when DI cannot find a matching binding.

fullContainerTreeOnError
Link copied to clipboard
common
abstract var fullContainerTreeOnError: Boolean

If true, NotFoundException thrown will contain the list of all the bindings available.

fullDescriptionOnError
Link copied to clipboard
common
abstract var fullDescriptionOnError: Boolean

If true, exceptions thrown will contain qualified names.

scope
Link copied to clipboard
common
abstract val scope: Scope<Any>

The scope that will be used by all bindings that are defined in this DSL context.