LateInitDI

class LateInitDI : DI

DI object that defers all method to a base DI object that can be set later.

You can use all lazy methods on this even if baseDI is not set, but you cannot retrieve a value while it is not set.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
var baseDI: DI

The user is responsible to set this property before actually retrieveing a value.

Link copied to clipboard
open override val container: DIContainer

Every methods eventually ends up to a call to this container.

Link copied to clipboard
open override val di: DI

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

Link copied to clipboard
open val diContext: DIContext<*>

A DI Aware class can define a context that is for all retrieval by overriding this property.

Link copied to clipboard

Return a direct DirectDI instance, with its receiver and context set to this DIAware receiver and context.

Link copied to clipboard
open val diTrigger: DITrigger?

Trigger to use that define when the retrieval will be done.

Link copied to clipboard

Allows to get factories / providers / instances with a tag set to the name of the receiving property.

Functions

Link copied to clipboard
fun <T : Any> DIAware.Constant(type: TypeToken<out T>): DIProperty<T>

Gets a constant of type T and tag whose tag is the name of the receiving property.

Link copied to clipboard
inline fun <T : Any> DIAware.constant(): LazyDelegate<T>

Gets a constant of type T and tag whose tag is the name of the receiving property.

Link copied to clipboard
fun <A, T : Any> DIAware.Factory(argType: TypeToken<in A>, type: TypeToken<out T>, tag: Any? = null): LazyDelegate<(A) -> T>

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

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

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

Link copied to clipboard
fun <A, T : Any> DIAware.FactoryOrNull(argType: TypeToken<in A>, type: TypeToken<out T>, tag: Any? = null): LazyDelegate<(A) -> T?>

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

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

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

Link copied to clipboard
inline fun <A : Any, T : Any> DI.hasFactory(tag: Any? = null): Boolean

Define whether a factory binding exists in the given DI container

Link copied to clipboard
inline fun <T : Any> DI.hasProvider(tag: Any? = null): Boolean

Define whether a provider binding exists in the given DI container

Link copied to clipboard
fun <T : Any> DIAware.Instance(type: TypeToken<out T>, tag: Any? = null): LazyDelegate<T>

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

fun <A, T : Any> DIAware.Instance(argType: TypeToken<in A>, type: TypeToken<T>, tag: Any? = null, arg: () -> A): LazyDelegate<T>

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

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

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

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

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

Link copied to clipboard
fun <T : Any> DIAware.InstanceOrNull(type: TypeToken<out T>, tag: Any? = null): LazyDelegate<T?>

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

fun <A, T : Any> DIAware.InstanceOrNull(argType: TypeToken<in A>, type: TypeToken<out T>, tag: Any? = null, arg: () -> A): LazyDelegate<T?>

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

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

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

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

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

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

Allows to create a new instance of an unbound object with the same API as when bounding one.

Link copied to clipboard
fun DIAware.On(context: DIContext<*> = this.diContext, trigger: DITrigger? = this.diTrigger): DI

Allows to create a new DI object with a context and/or a trigger set.

Link copied to clipboard
fun DIAware.on(trigger: DITrigger?): DI

Allows to create a new DI object with a trigger set.

inline fun <C : Any> DIAware.on(context: C, trigger: DITrigger? = this.diTrigger): DI
inline fun <C : Any> DIAware.on(trigger: DITrigger? = this.diTrigger, crossinline getContext: () -> C): DI

Allows to create a new DI object with a context and/or a trigger set.

Link copied to clipboard
fun <T : Any> DIAware.Provider(type: TypeToken<out T>, tag: Any? = null): LazyDelegate<() -> T>

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

fun <A, T : Any> DIAware.Provider(argType: TypeToken<in A>, type: TypeToken<out T>, tag: Any? = null, arg: () -> A): DIProperty<() -> T>

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

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

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

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

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

Link copied to clipboard
fun <T : Any> DIAware.ProviderOrNull(type: TypeToken<out T>, tag: Any? = null): LazyDelegate<() -> T?>

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

fun <A, T : Any> DIAware.ProviderOrNull(argType: TypeToken<in A>, type: TypeToken<out T>, tag: Any? = null, arg: () -> A): LazyDelegate<() -> T?>

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

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

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

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

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