SetBinder

Manage multiple bindings in a Set

Properties

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

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

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

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

Functions

Link copied to clipboard
abstract fun add(createBinding: () -> DIBinding<*, *, out T>)

Add a binding in the Set of type T

Link copied to clipboard
abstract fun addInstance(instance: T)

Adds an instance binding to the set.

Link copied to clipboard
abstract fun addProvider(creator: NoArgBindingDI<Any>.() -> T)

Adds a provider binding to the set.

Link copied to clipboard
abstract fun addSingleton(ref: RefMaker? = null, sync: Boolean = true, creator: NoArgBindingDI<Any>.() -> T)

Adds a singleton binding to the set.

Link copied to clipboard
abstract fun bind(tag: Any? = null, overrides: Boolean? = null, createBinding: () -> DIBinding<*, *, out T>)

Add a binding in the Set of type T, and also in the DI container

Link copied to clipboard
abstract fun bindInstance(tag: Any? = null, overrides: Boolean? = null, instance: T)

Binds an instance to both the set and the DI container.

Link copied to clipboard
abstract fun bindProvider(tag: Any? = null, overrides: Boolean? = null, creator: NoArgBindingDI<Any>.() -> T)

Binds a provider to both the set and the DI container.

Link copied to clipboard
abstract fun bindSingleton(tag: Any? = null, overrides: Boolean? = null, ref: RefMaker? = null, sync: Boolean = true, creator: NoArgBindingDI<Any>.() -> T)

Binds a singleton to both the set and the DI container.

Link copied to clipboard
inline fun <C : Any, A : Any, T : Any> DI.BindBuilder<C>.factory(noinline creator: BindingDI<C>.(A) -> T): Factory<C, A, T>

Creates a factory: each time an instance is needed, the function creator function will be called.

Link copied to clipboard
inline fun <C : Any, A : Any, T : Any> DI.BindBuilder.WithScope<C>.multiton(ref: RefMaker? = null, sync: Boolean = true, noinline creator: BindingDI<C>.(A) -> T): Multiton<C, A, T>

Creates a multiton: will create an instance on first request for each different argument and will subsequently always return the same instance for the same argument.

Link copied to clipboard
inline fun <C : Any, T : Any> DI.BindBuilder<C>.provider(noinline creator: NoArgBindingDI<C>.() -> T): Provider<C, T>

Creates a factory: each time an instance is needed, the function creator function will be called.

Link copied to clipboard
inline fun <C : Any, T : Any> DI.BindBuilder.WithScope<C>.singleton(ref: RefMaker? = null, sync: Boolean = true, noinline creator: NoArgBindingDI<C>.() -> T): Singleton<C, T>

Creates a singleton: will create an instance on first request and will subsequently always return the same instance.