MetalessInjectionScope

interface MetalessInjectionScope

An injection scope without meta-related operations. Because InjectionScope.meta itself returns (in theory) an InjectionScope, people may do scope.meta.meta.meta.meta... to infinity and beyond, which does not make sense. In order to prevent this, InjectionScope.meta instead returns a MetalessInjectionScope.

Functions

Link copied to clipboard
abstract 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).

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
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
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).