LazyKey
open class LazyKey<T : Any>(val type: KClass<T>) : ServiceKey<T, LazyKey.Entry<T, T>, Unit, LazyKey.PutParams<T>>
A ServiceKey for services that are created and stored lazily.
The provider lambda is executed only the first time a value for this key is requested from the ServiceLocator. The resulting instance is then stored and returned for all subsequent requests for the same key. The multi-thread initialization behavior is determined by the LazyThreadSafetyMode.
Inheritors
Types
Link copied to clipboard
inner class Entry<T : Any>(loader: () -> T, threadSafetyMode: LazyThreadSafetyMode) : ParamlessServiceEntry<T>
The ServiceEntry for a LazyKey. It holds the provider lambda and the created service.
Link copied to clipboard
Properties
Functions
Link copied to clipboard
Creates an Entry to provide values.
Link copied to clipboard
Retrieve the value from entry. The entry will have been created by a ServiceKey that is equals to this key. If this ServiceKey is only equals to other keys of the same class, then entry will be guaranteed to be of type Entry.