Package-level declarations

Types

Link copied to clipboard
sealed interface ClassKey<T : Any>

A ServiceKey that uses the service's own KClass as its identifier.

Link copied to clipboard

A ServiceKey that creates a new instance of a service every time one is requested.

Link copied to clipboard
data class LazyClassKey<T : Any>(val type: KClass<T>) : LazyKey<T> , ClassKey<T>

A ClassKey that provides a single value that is computed lazily.

Link copied to clipboard
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.

Link copied to clipboard
interface ServiceEntry<T>

An entry stored in a ServiceLocator to provide a value of type T.

Link copied to clipboard

A Key type used in a ServiceLocator. Will provide values of type T.

Link copied to clipboard
data class SingletonClassKey<T : Any>(val type: KClass<T>) : SingletonKey<T> , ClassKey<T>

A ClassKey that provides a single, eagerly-loaded value.

Link copied to clipboard
open class SingletonKey<T : Any>(val type: KClass<T>) : ServiceKey<T, SingletonKey.Entry<T>, Unit, T>

A ServiceKey for a pre-instantiated, eagerly-loaded service.

Functions

Link copied to clipboard

Creates a FactoryKey for the reified type T which may take parameters of type GetParams.

@JvmName(name = "FactoryKeyUnit")
inline fun <T : Any> FactoryKey(): FactoryKey<T, Unit>

Creates a FactoryKey for the reified type T that does not require parameters for creation.

fun <T : Any> FactoryKey(type: KClass<T>): FactoryKey<T, Unit>

Creates a FactoryKey for services that do not require parameters for creation.

Link copied to clipboard
inline fun <T : Any> LazyKey(): LazyKey<T>

Creates a LazyKey for the reified type T.

Link copied to clipboard
inline fun <T : Any> ServiceLocator.put(value: T)

Registers an eager singleton instance using a SingletonClassKey for the reified type T.

inline fun <T : Any> ServiceLocator.put(threadSafetyMode: LazyThreadSafetyMode = defaultLazyKeyThreadSafetyMode, noinline provider: () -> T)

Registers a lazy singleton provider using a LazyClassKey for the reified type T.

fun <T : Any> ServiceLocator.put(key: LazyKey<T>, threadSafetyMode: LazyThreadSafetyMode = getDefaultParams().threadSafetyMode, provider: () -> T)

Registers a lazy singleton provider for the given key.

Link copied to clipboard
inline fun <T : Any> SingletonKey(): SingletonKey<T>

Creates a SingletonKey for the reified type T.