bind

inline fun <T : Any> DI.Builder.bind(tag: Any? = null, overrides: Boolean? = null, noinline createBinding: () -> DIBinding<*, *, T>)

Attaches a binding to the DI container

Parameters

T

The type of value to bind.

tag

The tag to bind.

overrides

Whether this bind must or must not override an existing binding.


inline fun <T : Any> DI.Builder.bind(tag: Any? = null, overrides: Boolean? = null): DI.Builder.TypeBinder<T>

Starts the binding of a given type with a given tag.

T generics will be erased!

Return

The binder: call DI.Builder.TypeBinder.with on it to finish the binding syntax and register the binding.

Parameters

T

The type to bind.

tag

The tag to bind.

overrides

Whether this bind must, may or must not override an existing binding.


inline fun <T : Any> DI.Builder.bind(cls: KClass<T>, tag: Any? = null, overrides: Boolean? = null): DI.Builder.TypeBinder<T>

Binds a class type to a dependency injection (DI) builder.

Return

A TypeBinder instance that allows further customisation of the binding.

Parameters

cls

The class to be bound.

tag

An optional tag to associate with the binding, used to differentiate bindings of the same type.

overrides

An optional boolean indicating if the binding should override existing bindings. Default is null.