provider

inline fun <C : Any, T : Any> DI.BindBuilder<C>.provider(noinline creator: NoArgBindingDI<C>.() -> T): Provider<C, T>

Creates a factory: each time an instance is needed, the function creator function will be called.

T generics will be erased!

A provider is like a factory, but without argument.

Return

A provider ready to be bound.

Parameters

T

The created type.

creator

The function that will be called each time an instance is requested. Should create a new instance.


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

Gets a provider of T for the given type and tag.

T generics will be preserved!

Return

A provider.

Parameters

T

The type of object the provider returns.

tag

The bound tag, if any.

Throws

if no provider was found.

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


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

A & T generics will be preserved!

Return

A provider of T.

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

If no provider was found.

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


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

A & T generics will be preserved!

Return

A provider of T.

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

If no provider was found.

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


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

Gets a provider of T for the given type and tag.

T generics will be erased.

Return

A provider.

Parameters

T

The type of object the provider returns.

tag

The bound tag, if any.

Throws

if no provider was found.

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


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

A & T generics will be erased.

Return

A provider of T.

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

If no provider was found.

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


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

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

A & T generics will be erased.

Return

A provider of T.

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

If no provider was found.

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


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

A & T generics will be erased.

Return

A provider of T.

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

If no provider was found.

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


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

Gets a provider of T for the given type. The name of the receiving property is used as tag.

T generics will be erased!

Return

A provider.

Parameters

T

The type of object the provider returns.

Throws

if no provider was found.

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


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

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

A & T generics will be erased!

Return

A provider of T.

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

If no provider was found.

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


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

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

A & T generics will be erased!

Return

A provider of T.

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

If no provider was found.

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