Injector

fun interface Injector<out T> : ReadOnlyProperty<Any?, T>

An injector is a read-only property delegator that has constraints on T.

Injectors are requested by component classes using any inject construct (e.g. SComponent.inject or inject). In the environment, injectors are created using InjectionEnvironment.createInjector.

Parameters

T

The object type to inject

Functions

Link copied to clipboard
abstract operator fun getValue(thisRef: Any?, property: KProperty<*>): T

Extensions

Link copied to clipboard
infix inline fun <T, V, R : Any> ReadOnlyProperty<T, V>.wrapIn(crossinline mapper: (V) -> R): SynchronizedLazyPropertyWrapper<T, R>

Utility function that wraps a given property using the given wrapper. This is useful when you want to transform the output of a property in some way.

Link copied to clipboard
infix inline fun <T, V, R : Any> ReadOnlyProperty<T, V>.wrapInWithThisRef(crossinline mapper: (T, V) -> R): SynchronizedLazyPropertyWrapper<T, R>

Identical to wrapIn, but also gives you access to the object the property is owned by in the mapper lambda.