DIContainer

interface DIContainer

The Container is the entry point for retrieval without DI's inline & reified shenanigans.

In DI, every binding is stored as a factory. Providers are special classes of factories that take Unit as parameter.

Types

Link copied to clipboard
interface Builder

This is where you configure the bindings.

Properties

Link copied to clipboard
abstract val tree: DITree

The tree that contains all bindings.

Functions

Link copied to clipboard
abstract fun <C : Any, A, T : Any> allFactories(key: DI.Key<C, A, T>, context: C, overrideLevel: Int = 0): List<(A) -> T>

Retrieve all factories that match the given key.

Link copied to clipboard
open fun <C : Any, T : Any> allProviders(key: DI.Key<C, Unit, T>, context: C, overrideLevel: Int = 0): List<() -> T>

Retrieve all providers that match the given key.

Link copied to clipboard
abstract fun <C : Any, A, T : Any> factory(key: DI.Key<C, A, T>, context: C, overrideLevel: Int = 0): (A) -> T

Retrieve a factory for the given key.

Link copied to clipboard
abstract fun <C : Any, A, T : Any> factoryOrNull(key: DI.Key<C, A, T>, context: C, overrideLevel: Int = 0): (A) -> T?

Retrieve a factory for the given key, or null if none is found.

Link copied to clipboard
open fun <C : Any, T : Any> provider(key: DI.Key<C, Unit, T>, context: C, overrideLevel: Int = 0): () -> T

Retrieve a provider for the given key.

Link copied to clipboard
open fun <C : Any, T : Any> providerOrNull(key: DI.Key<C, Unit, T>, context: C, overrideLevel: Int = 0): () -> T?

Retrieve a provider for the given key, or null if none is found.