EagerImmutableMetaEnvironment

class EagerImmutableMetaEnvironment(context: EnvironmentContext) : InjectionEnvironment

An injection environment implementation with an eager evaluation strategy.

Note that this environment is only intended for meta-environments. It is not intended for regular-purpose (extensible) environments, which should instead use a MixedImmutableEnvironment.

Characteristics

  • Eager object creation. Objects are created upon construction of this environment.

  • Eager object injection. Objects are injected upon calling the injection method.

  • Idempotent/Immutable. Objects cannot be replaced, injection methods will always return the same thing.

Constructors

Link copied to clipboard
fun EagerImmutableMetaEnvironment(context: EnvironmentContext)

Types

Link copied to clipboard

Functions

Link copied to clipboard
open override fun <T : Any> createInjector(identifier: Identifier<T>, onInjection: (T) -> Unit): Injector<T>

Creates an Injector that can be used as a property delegator, bound against the given identifier.

Link copied to clipboard
open fun <T : Any> get(identifier: Identifier<T>): T

Gets the component identified by the given identifier. No guarantees are given on this function - it may not be idempotent, depending on the actual implementation.

Link copied to clipboard
open override fun getAllIdentifiers(): Sequence<Identifier<*>>

Returns a sequence of all the known identifiers present in this environment.

Link copied to clipboard
open override fun <T : Any> getOrNull(identifier: Identifier<T>): T?

Gets the component identified by the given identifier, or null if no such component exists. No guarantees are given on this function - it may not be idempotent, depending on the actual implementation.