winter / io.jentz.winter / Injector / instanceOrNull

instanceOrNull

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

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

Parameters

qualifier - An optional qualifier.

generics - Preserve generic type parameters.

Return
The created InjectedProperty.

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

Creates and registers a property delegate for an optional instance of type R. This lookups a factory of type (A) -> R and calls it with the supplied argument or returns null if no factory of type (A) -> R exists.

Parameters

argument - The argument for the factory.

qualifier - An optional qualifier.

generics - Preserve generic type parameters.

Return
The created InjectedProperty.