ktp / toothpick.ktp.binding / CanBeBound / toProviderInstance

toProviderInstance

fun toProviderInstance(providerInstance: Provider<out T>): CanProvideSingleton<T>

DSL method to associate an provider impl to a binding, more Kotlin friendly.

Parameters

providerInstance - the provider instance to be used for this binding.

Return
a binding statement for this key, with the provider class that can be further customized.

fun toProviderInstance(providerInstanceProvider: () -> T): CanProvideSingleton<T>

DSL method to associate an provider impl to a binding, more Kotlin friendly.

Parameters

providerInstanceProvider - a lambda used as a provider for this binding.

Return
a binding statement for this key, with the provider class that can be further customized.