Package-level declarations

Types

Link copied to clipboard

Thrown when there are two or more implicit dependencies that match the given key.

Link copied to clipboard

Thrown when resolving a given dependency loops back on itself.

Link copied to clipboard

Implementation of DependencyMap for referencing items from the server's file configuration.

Thrown when attempting to instantiate an abstract type using reflection.

Link copied to clipboard

Defines a policy for resolving conflicts between two dependency creation functions.

Link copied to clipboard
sealed interface DependencyConflictResult

Represents the result of a dependency conflict resolution within a dependency injection system.

Link copied to clipboard
sealed interface DependencyInitializer

Wraps the logic for creating a new instance of a dependency.

Link copied to clipboard

Configuration class for dependency injection settings and behavior customization.

Link copied to clipboard
open class DependencyInjectionException(message: String? = null, cause: Throwable? = null) : RuntimeException

Common parent for dependency injection problems.

Link copied to clipboard
data class DependencyKey(val type: TypeInfo, val name: String? = null, val qualifier: Any? = null)

Unique key for a dependency.

Link copied to clipboard

Functional interface for mapping a dependency key to its covariant types.

Link copied to clipboard
interface DependencyMap

A map of object instances.

Link copied to clipboard

Extension interface for dependency maps.

Link copied to clipboard

Represents a provider for managing dependencies in a dependency injection mechanism. This interface allows the registration of dependency initializers and the retrieval or instantiation of declared dependencies based on their unique keys.

Link copied to clipboard

Provides reflection to dependency injection so that it may create new instances from class references.

Link copied to clipboard

Provides the default reflection behavior for the JVM platform, relying on the standard library calls for inferring which constructors to use, and how to evaluate the parameters as dependency keys.

Link copied to clipboard

A central registry for managing and resolving dependencies within a dependency injection context.

Link copied to clipboard
fun interface DependencyResolution

Functional interface for generating a fresh DependencyResolver.

Link copied to clipboard
interface DependencyResolver : MutableDependencyMap, CoroutineScope

Extends DependencyMap with reflection, allowing for the automatic injection of types.

Link copied to clipboard
data class DependencyResolverContext(val resolver: DependencyResolver, val name: String)

Context for property delegation with chaining (i.e., dependencies.named("foo"))

Link copied to clipboard

Thrown when a dependency is declared more than once.

Link copied to clipboard

Thrown when a static reference cannot be resolved from the configuration file.

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

Thrown when attempting to resolve a dependency that was not declared.

Link copied to clipboard

A mutable extension of DependencyMap that allows for adding and retrieving dependencies.

Link copied to clipboard

Automatically failing implementation of DependencyReflection that is used by default when unsupported on the current platform.

Link copied to clipboard

Thrown when attempting to provide a dependency AFTER the dependency map is created.

Link copied to clipboard
data object PropertyQualifier

Qualifier for specifying when a dependency key maps to a property in the file configuration.

Properties

Link copied to clipboard

The default conflict policy ensures that explicit declarations take precedence over implicit types.

Link copied to clipboard

The default covariance logic for dependency keys.

Link copied to clipboard

Default reflection provider for the JVM, using standard JVM reflection calls for discovering constructors and parameter details.

Reflection is currently disabled for all non-JVM platforms.

Link copied to clipboard

A Ktor application plugin for managing the registration and resolution of module dependencies.

Link copied to clipboard

During testing, we ignore conflicts. This allows for replacing base implementations with mock values.

Link copied to clipboard

A predefined implementation of DependencyKeyCovariance that creates a covariant dependency key based on the given key. It generates a list containing a single dependency key with a new TypeInfo that retains the same type and Kotlin type as the original key.

Link copied to clipboard

A DependencyKeyCovariance that generates supertypes for out type arguments of parameterized types.

Link copied to clipboard

Standard covariance mapping for matching dependency keys to supertypes and implemented interfaces.

Link copied to clipboard

Matches name-qualified dependency keys to the unnamed forms.

Functions

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

DSL helper for declaring dependencies with dependencies {} block.

Link copied to clipboard
inline fun <T> DependencyKey(name: String? = null, qualifier: Any? = null): DependencyKey

Convenience function for DependencyKey(typeInfo<T>(), name, qualifier).

Link copied to clipboard

Get an item from the dependency map synchronously.

actual fun <T> <Error class: unknown class>.getBlocking(key: <Error class: unknown class>): T

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

Link copied to clipboard

Determines if the type associated with a DependencyKey is nullable.

Link copied to clipboard

Helper operator function for combining covariance logic.

Combines two DependencyMaps into one.

Link copied to clipboard
inline fun <E> DependencyRegistry.provide(crossinline function: suspend () -> E): DependencyRegistry.KeyContext<E>

Registers a dependency provider that takes no parameters and returns a value of type E.

inline fun <E, I1> DependencyRegistry.provide(crossinline function: suspend (I1) -> E): DependencyRegistry.KeyContext<E>

Registers a dependency provider that takes one input parameter and returns a value of type E.

inline fun <E, I1, I2> DependencyRegistry.provide(crossinline function: suspend (I1, I2) -> E): DependencyRegistry.KeyContext<E>

Registers a dependency provider that takes two input parameters and returns a value of type E.

inline fun <E, I1, I2, I3> DependencyRegistry.provide(crossinline function: suspend (I1, I2, I3) -> E): DependencyRegistry.KeyContext<E>

Registers a dependency provider that takes three input parameters and returns a value of type E.

inline fun <E, I1, I2, I3, I4> DependencyRegistry.provide(crossinline function: suspend (I1, I2, I3, I4) -> E): DependencyRegistry.KeyContext<E>

Registers a dependency provider that takes four input parameters and returns a value of type E.

inline fun <E, I1, I2, I3, I4, I5> DependencyRegistry.provide(crossinline function: suspend (I1, I2, I3, I4, I5) -> E): DependencyRegistry.KeyContext<E>

Registers a dependency provider that takes five input parameters and returns a value of type E.

inline fun <E, I1, I2, I3, I4, I5, I6> DependencyRegistry.provide(crossinline function: suspend (I1, I2, I3, I4, I5, I6) -> E): DependencyRegistry.KeyContext<E>

Registers a dependency provider that takes six input parameters and returns a value of type E.

inline fun <T> DependencyProvider.provide(name: String? = null, noinline provide: DependencyResolver.() -> T?)

Basic call for providing a dependency, like provide<Service> { ServiceImpl() }.

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

Helper operator function for combining covariance logic.