DependencyRegistry
A central registry for managing and resolving dependencies within a dependency injection context.
The DependencyRegistry
class acts as both a DependencyProvider
and a DependencyResolver
. It facilitates the registration of dependencies through a DependencyProvider
as well as the resolution and validation of dependencies using the provided resolver mechanism. This registry also supports reflective creation of instances and type-safe access to registered dependencies.
Parameters
The delegate resolver for finding registered dependencies.
The delegate provider responsible for registering new dependencies..
A reflection implementation that supports dynamic instantiation of classes.
Types
Properties
Functions
Checks if the given dependency key is present in the dependency map.
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.
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.
Retrieves an instance of the dependency associated with the given key from the dependency map.
Get an item from the dependency map synchronously.
Blocking is unavailable for other platforms, so we instead attempt to get the completed value.
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.
Decorates the dependency resolver with a qualified name for the expected type.
Combines two DependencyMap
s into one.
Provides an instance of the dependency associated with the specified kClass.
Basic call for providing a dependency, like provide<Service> { ServiceImpl() }
.
Registers a dependency provider that takes no parameters and returns a value of type E.
Registers a dependency provider that takes one input parameter and returns a value of type E.
Registers a dependency provider that takes two input parameters and returns a value of type E.
Registers a dependency provider that takes three input parameters and returns a value of type E.
Registers a dependency provider that takes four input parameters and returns a value of type E.
Registers a dependency provider that takes five input parameters and returns a value of type E.
Registers a dependency provider that takes six input parameters and returns a value of type E.
Basic call for providing a dependency, like provide<Service> { ServiceImpl() }
.
Provides a delegated property for accessing a dependency from a DependencyRegistry. This operator function allows property delegation, ensuring the required dependency is registered and retrievable through the registry.
Indicates that the given dependency is required.
Get a deferred dependency from the map for the key represented by the type (and optionally, with the given name).
Associate the given dependency key with the corresponding initializer.