DependencyModuleBuilder

A concrete implementation of AbstractModuleBuilder for defining a standard module. This is the primary entry point for the module definition DSL.

Constructors

Link copied to clipboard
constructor(scope: Scope)

Properties

Link copied to clipboard

A mutable list that collects all the DependencyFactory instances created by the builder.

Link copied to clipboard
open override val scope: Scope

The current Scope in which the module is being built.

Functions

Link copied to clipboard
fun <T : AbstractModuleBuilder> baseScope(qualifier: Qualifier, builderGenerator: DefaultScope.() -> T, block: T.() -> Unit)

An internal-use function to create and register a sub-scope factory.

Link copied to clipboard

Builds and returns the DependencyModule containing all the defined factories.

Link copied to clipboard
inline fun <T : Any> factory(qualifier: Qualifier = TypeQualifier(T::class), noinline create: () -> T)

Defines a dependency that will have a new instance created every time it is requested.

Link copied to clipboard
inline fun <T : Any> get(qualifier: Qualifier = TypeQualifier(T::class)): T

A helper function to resolve a dependency from the current scope. This is intended to be used within the create lambda of other dependency definitions.

Link copied to clipboard
inline fun <T : Any> scope(qualifier: Qualifier = TypeQualifier(T::class), noinline block: DependencyModuleBuilder.() -> Unit)

Defines a nested scope within the current module.

Link copied to clipboard
inline fun <T : Any> single(qualifier: Qualifier = TypeQualifier(T::class), noinline create: () -> T)

Defines a singleton dependency that will have only one instance created and shared throughout the scope's lifecycle.