SimpleEnvironmentBasedScope

class SimpleEnvironmentBasedScope(env: InjectionEnvironment) : InjectionScope

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
fun SimpleEnvironmentBasedScope(env: InjectionEnvironment)

Functions

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
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).

Properties

Link copied to clipboard
open override val meta: Nothing

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