DirectDIAware

interface DirectDIAware

Any class that extends this interface can use direct DI "seamlessly".

Properties

directDI
Link copied to clipboard
abstract val directDI: DirectDI

A Direct DI Aware class must be within reach of a DirectDI object.

Inheritors

DirectDIBase
Link copied to clipboard

Extensions

allFactories
Link copied to clipboard
inline fun <A : Any, T : Any> DirectDIAware.allFactories(tag: Any? = null): List<(A) -> T>

Gets all factories that can return a T for the given argument type, return type and tag.

allInstances
Link copied to clipboard
inline fun <T : Any> DirectDIAware.allInstances(tag: Any? = null): List<T>

Gets all instances that can return a T for the given type and tag.

inline fun <A : Any, T : Any> DirectDIAware.allInstances(tag: Any? = null, arg: A): List<T>
inline fun <A, T : Any> DirectDIAware.allInstances(tag: Any? = null, arg: Typed<A>): List<T>

Gets all instances that can return a T for the given type and tag, curried from factories for the given argument.

allProviders
Link copied to clipboard
inline fun <T : Any> DirectDIAware.allProviders(tag: Any? = null): List<() -> T>

Gets all providers that can return a T for the given type and tag.

inline fun <A : Any, T : Any> DirectDIAware.allProviders(tag: Any? = null, arg: A): List<() -> T>
inline fun <A, T : Any> DirectDIAware.allProviders(tag: Any? = null, arg: Typed<A>): List<() -> T>
inline fun <A : Any, T : Any> DirectDIAware.allProviders(tag: Any? = null, noinline fArg: () -> A): List<() -> T>

Gets all providers that can return a T for the given type and tag, curried from factories for the given argument.

factory
Link copied to clipboard
inline fun <A : Any, T : Any> DirectDIAware.factory(tag: Any? = null): (A) -> T

Gets a factory of T for the given argument type, return type and tag.

factoryOrNull
Link copied to clipboard
inline fun <A : Any, T : Any> DirectDIAware.factoryOrNull(tag: Any? = null): (A) -> T?

Gets a factory of T for the given argument type, return type and tag, or nul if none is found.

instance
Link copied to clipboard
inline fun <T : Any> DirectDIAware.instance(tag: Any? = null): T

Gets an instance of T for the given type and tag.

inline fun <A : Any, T : Any> DirectDIAware.instance(tag: Any? = null, arg: A): T
inline fun <A, T : Any> DirectDIAware.instance(tag: Any? = null, arg: Typed<A>): T

Gets an instance of T for the given type and tag, curried from a factory for the given argument.

instanceOrNull
Link copied to clipboard
inline fun <T : Any> DirectDIAware.instanceOrNull(tag: Any? = null): T?

Gets an instance of T for the given type and tag, or null if none is found.

inline fun <A : Any, T : Any> DirectDIAware.instanceOrNull(tag: Any? = null, arg: A): T?
inline fun <A, T : Any> DirectDIAware.instanceOrNull(tag: Any? = null, arg: Typed<A>): T?

Gets an instance of T for the given type and tag, curried from a factory for the given argument, or null if none is found.

lazy
Link copied to clipboard
val DirectDIAware.lazy: DI

Returns a regular DI instance (DI is lazy by default).

newInstance
Link copied to clipboard
inline fun <T> DirectDIAware.newInstance(creator: DirectDI.() -> T): T

Allows the creation of a new instance with DI injection.

on
Link copied to clipboard
inline fun <C : Any> DirectDIAware.on(context: C): DirectDI

Returns a DirectDI with its context and/or receiver changed.

provider
Link copied to clipboard
inline fun <T : Any> DirectDIAware.provider(tag: Any? = null): () -> T

Gets a provider of T for the given type and tag.

inline fun <A : Any, T : Any> DirectDIAware.provider(tag: Any? = null, arg: A): () -> T
inline fun <A, T : Any> DirectDIAware.provider(tag: Any? = null, arg: Typed<A>): () -> T
inline fun <A : Any, T : Any> DirectDIAware.provider(tag: Any? = null, noinline fArg: () -> A): () -> T

Gets a provider of T for the given type and tag, curried from a factory for the given argument.

providerOrNull
Link copied to clipboard
inline fun <T : Any> DirectDIAware.providerOrNull(tag: Any? = null): () -> T?

Gets a provider of T for the given type and tag, or null if none is found.

inline fun <A : Any, T : Any> DirectDIAware.providerOrNull(tag: Any? = null, arg: A): () -> T?
inline fun <A, T : Any> DirectDIAware.providerOrNull(tag: Any? = null, arg: Typed<A>): () -> T?
inline fun <A : Any, T : Any> DirectDIAware.providerOrNull(tag: Any? = null, noinline fArg: () -> A): () -> T?

Gets a provider of T for the given type and tag, curried from a factory for the given argument, or null if none is found.