rememberNamedInstance

inline fun <T : Any> rememberNamedInstance(): LazyDelegate<T>

Retrieves and keeps reference on a named instance of T for the given type and tag.

T generics will be preserved!

Return

An instance of T.

Parameters

T

The type of object to retrieve.

Throws

DI.NotFoundException

if no provider was found.

DI.DependencyLoopException

If the instance construction triggered a dependency loop.


inline fun <A : Any, T : Any> rememberNamedInstance(arg: A): LazyDelegate<T>

Retrieves and keeps a reference on an instance of T for the given, curried from a factory that takes an argument A.

A & T generics will be preserved!

Return

An instance of T.

Parameters

A

The type of argument the curried factory takes.

T

The type of object to retrieve.

arg

The argument that will be given to the factory when curried.

Throws

DI.NotFoundException

If no provider was found.

DI.DependencyLoopException

If the value construction triggered a dependency loop.


inline fun <A : Any, T : Any> rememberNamedInstance(noinline fArg: () -> A): LazyDelegate<T>

Retrieves and keeps a reference on an instance of T for the given fArg, curried from a factory that takes an argument A.

Parameters

fArg

The argument that will be given to the factory when curried. This lambda will be evaluated at first usage of the injected argument, and then cached, meaning that changing the result of fArg will NOT cause the dependency to be re-injected. If you don't want that, please use the non-lambda overload.