ModuleBuilderDsl

DSL builder class for InjectableModules. It does not add functionality other than the building logic. All DSL functionalities are provided as extension functions of ContextBuilderDsl.

Constructors

Link copied to clipboard
constructor(name: String)

Functions

Link copied to clipboard
open override fun build(): InjectableModule
Link copied to clipboard
open override 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.

Link copied to clipboard

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

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

Add a definition of type T with the given supplier.

Add a definition of type T with the given constructor.

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(qualifier: Qualifier, supplier: KFunction<T>): ScopedSupplierDeclaration<out Any>

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

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<out Any>

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

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.

Link copied to clipboard

Add a function definition to this environment for the given function, with its configuration.

Add a function definition to this environment for the given function.

Add a function definition to this environment for the given function and qualifier.