providerOrNull

inline fun <T : Any> DIAware.providerOrNull(tag: Any? = null): LazyDelegate<() -> T?>

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

T generics will be preserved!

Return

A provider, or null if no provider was found.

Parameters

T

The type of object the provider returns.

tag

The bound tag, if any.

Throws

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


inline fun <A : Any, T : Any> DIAware.providerOrNull(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.

A & T generics will be preserved!

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.

tag

The bound tag, if any.

arg

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

Throws

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


inline fun <A, T : Any> DIAware.providerOrNull(tag: Any? = null, arg: Typed<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.

The argument type is extracted from the Typed.type of the argument.

A & T generics will be preserved!

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.

tag

The bound tag, if any.

arg

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

Throws

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


inline fun <A : Any, T : Any> DIAware.providerOrNull(tag: Any? = null, noinline fArg: () -> 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.

A & T generics will be preserved!

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.

tag

The bound tag, if any.

fArg

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.


inline fun <T : Any> DirectDIAware.providerOrNull(tag: Any? = null): () -> T?

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

T generics will be erased.

Return

A provider, or null if no provider was found.

Parameters

T

The type of object the provider returns.

tag

The bound tag, if any.

Throws

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


inline fun <A : Any, T : Any> DirectDIAware.providerOrNull(tag: Any? = null, arg: A): () -> T?

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

A & T generics will be erased.

Return

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

Parameters

A

The type of argument the curried factory takes.

T

The type of object to retrieve with the returned provider.

tag

The bound tag, if any.

arg

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

Throws

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


inline fun <A, T : Any> DirectDIAware.providerOrNull(tag: Any? = null, arg: Typed<A>): () -> T?

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

The argument type is extracted from the Typed.type of the argument.

A & T generics will be erased.

Return

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

Parameters

A

The type of argument the curried factory takes.

T

The type of object to retrieve with the returned provider.

tag

The bound tag, if any.

arg

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

Throws

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


inline fun <A : Any, T : Any> DirectDIAware.providerOrNull(tag: Any? = null, noinline fArg: () -> A): () -> T?

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

A & T generics will be erased.

Return

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

Parameters

A

The type of argument the curried factory takes.

T

The type of object to retrieve with the returned provider.

tag

The bound tag, if any.

fArg

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.


inline fun <T : Any> Named.providerOrNull(): LazyDelegate<() -> T?>

Gets a provider of T for the given type, or null if none is found. The name of the receiving property is used as tag.

T generics will be erased!

Return

A provider, or null if no provider was found.

Parameters

T

The type of object the provider returns.

Throws

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


inline fun <A : Any, T : Any> Named.providerOrNull(arg: A): LazyDelegate<() -> T?>

Gets a provider of T for the given type, curried from a factory that takes an argument A, or null if none is found. The name of the receiving property is used as tag.

A & T generics will be erased!

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.

arg

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

Throws

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


inline fun <A, T : Any> Named.providerOrNull(arg: Typed<A>): LazyDelegate<() -> T?>

Gets a provider of T for the given type, curried from a factory that takes an argument A, or null if none is found. The name of the receiving property is used as tag.

The argument type is extracted from the Typed.type of the argument.

A & T generics will be erased!

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.

arg

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

Throws

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


inline fun <A : Any, T : Any> Named.providerOrNull(noinline fArg: () -> A): LazyDelegate<() -> T?>

Gets a provider of T for the given type, curried from a factory that takes an argument A, or null if none is found. The name of the receiving property is used as tag.

A & T generics will be erased!

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.

fArg

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.