ProviderOrNull

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

Gets a provider of T for the given type and tag, or null if none is found.

Return

A provider of T, or null if no provider was found.

Parameters

T

The type of object to retrieve with the returned provider.

type

The type of object to retrieve with the returned provider.

tag

The bound tag, if any.

Throws

When calling the provider, if the value construction triggered a dependency loop.


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

Gets a provider of T for the given type and tag, curried from a factory that takes an argument A, or null if none is found.

Return

A provider of T, or null if no factory was found.

Parameters

A

The type of argument the curried factory takes.

T

The type of object to retrieve with the returned provider.

argType

The type of argument the curried factory takes.

type

The type of object to retrieve with the returned provider.

tag

The bound tag, if any.

arg

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

Throws

When calling the provider, if the value construction triggered a dependency loop.