ContextBuilderDsl

interface ContextBuilderDsl

Context for Tegral DI builders, such as module builders (tegralDiModule) or environment builders (tegralDi).

DSL elements should use this class as a receiver, like the put functions.

Functions

Link copied to clipboard
abstract fun <T : Any> put(declaration: Declaration<T>)

Adds a declaration to this context. You will rarely need to call this function directly, as many other put functions exist for a more DSL-ish approach.

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard
inline fun <T : Any> ContextBuilderDsl.put(noinline supplier: ScopedSupplier<T>): ScopedSupplierDeclaration<T>

Add a definition of type T with the given supplier.

inline fun <T : Any> ContextBuilderDsl.put(qualifier: Qualifier, noinline supplier: ScopedSupplier<T>): ScopedSupplierDeclaration<T>
fun <T : Any> ContextBuilderDsl.put(    kclass: KClass<T>,     qualifier: Qualifier = EmptyQualifier,     supplier: ScopedSupplier<T>): ScopedSupplierDeclaration<T>

Add a definition of type T with the given qualifier and supplier.

inline fun <T : Any> ContextBuilderDsl.put(supplier: KFunction<T>): ScopedSupplierDeclaration<T>

Add a definition of type T with the given constructor.

inline fun <T : Any> ContextBuilderDsl.put(qualifier: Qualifier, supplier: KFunction<T>): ScopedSupplierDeclaration<T>

Add a definition of type T with the given qualifier and constructor.

fun <T : Any> ContextBuilderDsl.put(kclass: KClass<T>, supplier: KFunction<T>): ScopedSupplierDeclaration<T>

Add a definition of type T with the given class and constructor.

fun <T : Any> ContextBuilderDsl.put(    kclass: KClass<T>,     qualifier: Qualifier,     supplier: KFunction<T>): ScopedSupplierDeclaration<T>

Add a definition of type T with the given class, qualifier and constructor.

fun ContextBuilderDsl.put(module: InjectableModule)

Add a module to the current definition. This adds all the declarations within the module to this context.

Link copied to clipboard
inline fun <TAlias : Any, TTarget : TAlias> ContextBuilderDsl.putAlias(aliasQualifier: Qualifier = EmptyQualifier, targetQualifier: Qualifier = EmptyQualifier): Declaration<TAlias>
fun <TAlias : Any, TTarget : TAlias> ContextBuilderDsl.putAlias(    aliasClass: KClass<TAlias>,     aliasQualifier: Qualifier = EmptyQualifier,     targetClass: KClass<TTarget>,     targetQualifier: Qualifier = EmptyQualifier): Declaration<TAlias>

Adds an alias to another component within this environment.

Link copied to clipboard
inline fun <T : Any> ContextBuilderDsl.putFactory(noinline block: (Any) -> T)

Allows to put a factory within the module or environment.