SimpleEnvironmentBasedScope

An injection scope that delegates the injection to the given environment, without any support for injecting from meta-environments.

Use the EnvironmentBasedScope constructor function to create the appropriate instance.

Constructors

Link copied to clipboard
constructor(env: InjectionEnvironment)

Functions

Link copied to clipboard

DSL for injecting factory-made objects. Usage is factory from scope.

Link copied to clipboard
open override fun <T : Any> inject(what: Identifier<T>): Injector<T>

Create an injector for the given identifier. The behavior of the injection depends on the injection environment, but this is guaranteed to return an element of type T.

Link copied to clipboard
operator fun <T : Any> InjectionScope.invoke(identifier: Identifier<T>): ReadOnlyProperty<Any?, T>

Create an injector for the given identifier. See InjectionScope.inject for more information.

inline operator fun <T : Any> MetalessInjectionScope.invoke(qualifier: Qualifier = EmptyQualifier): ReadOnlyProperty<Any?, T>

Create an injector for the given class, turned to an identifier, and an optional qualifier. See InjectionScope.inject for more information.

Link copied to clipboard
open fun <T : Any> optional(what: Identifier<T>): Injector<T?>

Create an injector for the given identifier. If such an identifier cannot be found within the environment, returns null (unlike inject which throws a ComponentNotFoundException).

Link copied to clipboard
inline fun <T : Any> MetalessInjectionScope.optional(qualifier: Qualifier = EmptyQualifier): ReadOnlyProperty<Any?, T?>

Create an injector for the given class and optional qualifier. If such an identifier cannot be found within the environment, returns null (unlike other functions which throw a ComponentNotFoundException).

Properties

Link copied to clipboard
open override val meta: Nothing

Returns another injection scope that provides access to the components in the meta-environment.