winter / io.jentz.winter / Injector / lazyInstance

lazyInstance

inline fun <reified R : Any> lazyInstance(qualifier: Any? = null, generics: Boolean = false): Injector.InjectedProperty<R>

Creates and registers a lazy property delegate for an instance of type R.

The instance gets retrieved/created on first property access.

Parameters

qualifier - An optional qualifier.

generics - Preserve generic type parameters.

Return
The created InjectedProperty.

inline fun <reified A, reified R : Any> lazyInstance(argument: A, qualifier: Any? = null, generics: Boolean = false): Injector.InjectedProperty<R>

Creates and registers a lazy property delegate for an instance of type R.

This lookups a factory of type (A) -> R and calls it with the supplied argument.

The instance gets retrieved/created on first property access.

Parameters

argument - The argument for the factory.

qualifier - An optional qualifier.

generics - Preserve generic type parameters.

Return
The created InjectedProperty.