Instance

fun <T : Any> DIAware.Instance(type: TypeToken<out T>, tag: Any? = null): LazyDelegate<T>

Gets an instance of T for the given type and tag.

Return

An instance of T.

Parameters

T

The type of object to retrieve.

type

The type of object to retrieve.

tag

The bound tag, if any.

Throws

If no provider was found.

If the value construction triggered a dependency loop.


fun <A, T : Any> DIAware.Instance(argType: TypeToken<in A>, type: TypeToken<T>, tag: Any? = null, arg: () -> A): LazyDelegate<T>

Gets an instance of T for the given type and tag, curried from a factory that takes an argument A.

Return

An instance of T.

Parameters

A

The type of argument the curried factory takes.

T

The type of object to retrieve.

argType

The type of argument the curried factory takes.

type

The type of object to retrieve.

tag

The bound tag, if any.

arg

A function that returns the argument that will be given to the factory when curried.

Throws

If no provider was found.

If the value construction triggered a dependency loop.