alias

fun <R0, R1> alias(targetKey: TypeKey<R0>, newKey: TypeKey<R1>)(source)

Creates an alias entry.

Be careful, this method will not check if a type cast is possible.

Example:

singleton { ReposViewModel(instance()) }

alias(erased<ReposViewModel>(), generic<ViewModel<ReposViewState>>())

Parameters

targetKey

The TypeKey of an entry an alias should be created for.

newKey

The alias TypeKey.

Throws

If newKey entry already exists and override is false.


fun <R, A, S : UnboundService<R>> S.alias(key: TypeKey<A>): S(source)

Create an alias entry for the UnboundService.

Be careful, this method will not check if a type cast is possible.

Example:

singleton {
ReposViewModel(instance())
}.alias(generic<ViewModel<ReposViewState>>())

Parameters

key

The TypeKey of the alias.


inline fun <R, A : Any, S : UnboundService<R>> S.alias(kClass: KClass<A>, qualifier: Qualifier? = null): S(source)

Create an alias entry for the UnboundService.

Be careful, this method will not check if a type cast is possible.

Example:

singleton {
ReposViewModelImpl(instance())
}.alias(::ReposViewModel)

Parameters

kClass

The KClass of the alias.

qualifier

The optional Qualifier for the alias.