MapDependencyResolver

class MapDependencyResolver(map: DependencyInitializerMap, extension: DependencyMap, val reflection: DependencyReflection, waitForValues: Boolean = false, coroutineScope: CoroutineScope) : DependencyResolver, CoroutineScope(source)

Constructors

Link copied to clipboard
constructor(map: DependencyInitializerMap, extension: DependencyMap, reflection: DependencyReflection, waitForValues: Boolean = false, coroutineScope: CoroutineScope)

Properties

Link copied to clipboard
Link copied to clipboard
open override val reflection: DependencyReflection

Functions

Link copied to clipboard
open override fun contains(key: DependencyKey): Boolean

Checks if the given dependency key is present in the dependency map.

Link copied to clipboard
inline suspend fun <T : Any> DependencyResolver.create(): T

Creates an instance of the specified type T using the dependency resolver. This function uses the DependencyReflection mechanism to dynamically construct an instance of the requested type, resolving dependencies as needed.

inline suspend fun <T : Any> DependencyResolver.create(kClass: KClass<out T>): T

Creates or retrieves an instance of the specified type T from the DependencyResolver. If the instance does not already exist, it is created using reflection.

Link copied to clipboard
open suspend fun <T> get(key: DependencyKey): T

Retrieves an instance of the dependency associated with the given key from the dependency map.

Link copied to clipboard

Get an item from the dependency map synchronously.

Blocking is unavailable for other platforms, so we instead attempt to get the completed value.

Link copied to clipboard
open fun <T> getDeferred(key: DependencyKey): Deferred<T>
Link copied to clipboard
Link copied to clipboard
open suspend override fun <T> getOrPut(key: DependencyKey, defaultValue: suspend () -> T): T

Retrieves the value associated with the specified key if it exists. If the key does not already have an associated value, the result of invoking the defaultValue function will be stored and returned as the value for the given key.

Link copied to clipboard

Decorates the dependency resolver with a qualified name for the expected type.

Link copied to clipboard

Combines two DependencyMaps into one.

Link copied to clipboard
inline suspend fun <T> DependencyResolver.resolve(key: String? = null): T

Get the dependency from the map for the key represented by the type (and optionally, with the given name).

Link copied to clipboard

Updates the waitForValues flag so that future consumers will fail immediately when no initializer is found.