Package org.kodein.di

Types

BindingsMap
Link copied to clipboard
common
typealias BindingsMap = Map<DI.Key<*, *, *>, List<DIDefinition<*, *, *>>>

A Map containing all bindings associated to their keys

Copy
Link copied to clipboard
common
interface Copy
Simple interface that returns a the keys to copy from a container.
CopySpecs
Link copied to clipboard
common
class CopySpecs(all: Boolean) : SearchSpecs
Defines which bindings are to be copied from a parent DI to a child DI.
DI
Link copied to clipboard
common
interface DI : DIAware
KOtlin DEpendency INjection.
DIAware
Link copied to clipboard
common
interface DIAware
Any class that extends this interface can use DI "seamlessly".
DIContainer
Link copied to clipboard
common
interface DIContainer
The Container is the entry point for retrieval without DI's inline & reified shenanigans.
DIContext
Link copied to clipboard
common
interface DIContext<C : Any>
Defines a context and its type to be used by Di
DIDefining
Link copied to clipboard
common
open class DIDefining<C : Any, A, T : Any>(binding: DIBinding<C, A, T>, fromModule: String?)
A binding that is being defined inside a DI.Builder bloc.
DIDefinition
Link copied to clipboard
common
class DIDefinition<C : Any, A, T : Any>(binding: DIBinding<C, A, T>, fromModule: String?, tree: DITree) : DIDefining<C, A, T>
A definition is a binding that is associated to a DITree.
DIProperty
Link copied to clipboard
common
class DIProperty<out V>(trigger: DITrigger?, originalContext: DIContext<*>, get: (DIContext<*>, String) -> V) : LazyDelegate<V>
A property delegate provider for DI retrieval.
DIPropertyMap
Link copied to clipboard
common
class DIPropertyMap<in I, out O>(base: DIProperty<I>, map: (I) -> O) : LazyDelegate<O>
DirectDI
Link copied to clipboard
common
interface DirectDI : DirectDIBase
D stands for Direct.
interface DirectDI : DirectDIBase
interface DirectDI : DirectDIBase
interface DirectDI : DirectDIBase
DirectDIAware
Link copied to clipboard
common
interface DirectDIAware
Any class that extends this interface can use direct DI "seamlessly".
DirectDIBase
Link copied to clipboard
common
interface DirectDIBase : DirectDIAware
DITree
Link copied to clipboard
common
interface DITree
Tree where the bindings and their factories are sorted & stored.
DITrigger
Link copied to clipboard
common
class DITrigger
A trigger is used to force retrieval at a given time rather than at first property access.
FindDSL
Link copied to clipboard
common
class FindDSL : SearchDSL
DSL to find bindings.
LateInitDI
Link copied to clipboard
common
class LateInitDI : DI
DI object that defers all method to a base DI object that can be set later.
LazyDelegate
Link copied to clipboard
common
interface LazyDelegate<out V>
LazyDI
Link copied to clipboard
common
class LazyDI(f: () -> DI) : DI
DI object that defers all method to a DI object that will be created only upon first retrieval.
Named
Link copied to clipboard
common
inline class Named(di: DIAware)
SearchDSL
Link copied to clipboard
common
open class SearchDSL
DSL that facilitates the creation of a SearchSpecs object.
SearchSpecs
Link copied to clipboard
common
open class SearchSpecs(contextType: TypeToken<*>?, argType: TypeToken<*>?, type: TypeToken<*>?, tag: Any?)
Defines the specs to search bindings from (in)complete data with CopySpecs or DITree.find.
softReference
Link copied to clipboard
object softReference : RefMaker
Soft Reference Maker.
threadLocal
Link copied to clipboard
object threadLocal : RefMaker
Thread Local Reference Maker.
Typed
Link copied to clipboard
common
interface Typed<A>
Used as an argument for currying functions, allows to define a value and its type.
weakReference
Link copied to clipboard
object weakReference : RefMaker
Weak Reference Maker.

Functions

AllFactories
Link copied to clipboard
inline fun <A : Any, T : Any> DIAware.allFactories(tag: Any? = null): DIProperty<List<(A) -> T>>
Gets all factories that match the the given argument type, return type and tag.
inline fun <A : Any, T : Any> DirectDI.allFactories(tag: Any? = null): List<(A) -> T>
Gets all factories that can return a T for the given argument type, return type and tag.
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> DIAware.allInstances(tag: Any? = null): DIProperty<List<T>>
Gets all instances from providers that match the the given return type and tag.
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> DIAware.allInstances(tag: Any? = null, arg: A): DIProperty<List<T>>
Gets all instances from providers that match the the given return type and tag, curried from factories that take an argument A.
inline fun <A : Any, T : Any> DIAware.allInstances(tag: Any? = null, noinline fArg: () -> A): DIProperty<List<T>>
Gets all instances from providers that match the the given return type and tag, curried from factories that take an argument A.
inline fun <A, T : Any> DIAware.allInstances(tag: Any? = null, arg: Typed<A>): DIProperty<List<T>>
Gets all instances from providers that match the the given return type and tag, curried from factories that take an argument A.
inline fun <A : Any, T : Any> DirectDIAware.allInstances(tag: Any? = null, arg: A): List<T>
Gets all instances that can return a T for the given type and tag, curried from factories for the given argument.
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> DIAware.allProviders(tag: Any? = null): DIProperty<List<() -> T>>
Gets all providers that match the the given return type and tag.
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> DIAware.allProviders(tag: Any? = null, arg: A): DIProperty<List<() -> T>>
Gets all providers that match the the given return type and tag, curried from factories that take an argument A.
inline fun <A : Any, T : Any> DIAware.allProviders(tag: Any? = null, noinline fArg: () -> A): DIProperty<List<() -> T>>
Gets all providers that match the the given return type and tag, curried from factories that take an argument A.
inline fun <A, T : Any> DIAware.allProviders(tag: Any? = null, arg: Typed<A>): DIProperty<List<() -> T>>
Gets all providers that match the the given return type and tag, curried from factories that take an argument A.
inline fun <A : Any, T : Any> DirectDIAware.allProviders(tag: Any? = null, arg: A): List<() -> T>
Gets all providers that can return a T for the given type and tag, curried from factories for the given argument.
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.
inline fun <A, T : Any> DirectDIAware.allProviders(tag: Any? = null, arg: Typed<A>): List<() -> T>
Gets all providers that can return a T for the given type and tag, curried from factories for the given argument.
argSetBinding
Link copied to clipboard
common
inline fun <A : Any, T : Any> DI.Builder.argSetBinding(): ArgSetBinding<Any, A, T>
Creates a set: multiple bindings can be added in this set.
argument
Link copied to clipboard
common
inline fun <T : Any> SearchDSL.argument(): SearchDSL.Spec
Creates an argument constrained spec.
bind
Link copied to clipboard
common
inline fun <T : Any> DI.Builder.bind(tag: Any? = null, overrides: Boolean? = null): DI.Builder.TypeBinder<T>
Starts the binding of a given type with a given tag.
fun DI.Builder.bind(tag: Any? = null, overrides: Boolean? = null): DI.Builder.DirectBinder
Starts a direct binding with a given tag.
inline fun <T : Any> DI.Builder.bind(tag: Any? = null, overrides: Boolean? = null, noinline createBinding: () -> DIBinding<*, *, T>)
Attaches a binding to the DI container
bindArgSet
Link copied to clipboard
common
inline fun <A : Any, T : Any> DI.Builder.bindArgSet(tag: Any? = null, overrides: Boolean? = null)
Creates a set: multiple bindings can be added in this set.
bindConstant
Link copied to clipboard
common
inline fun <T : Any> DI.Builder.bindConstant(tag: Any, overrides: Boolean? = null, creator: () -> T)
Binds a constant provider: will always return the given instance.
bindFactory
Link copied to clipboard
common
inline fun <A : Any, T : Any> DI.Builder.bindFactory(tag: Any? = null, overrides: Boolean? = null, noinline creator: DirectDI.(A) -> T)
Binds a factory: each time an instance is needed, the function creator function will be called.
binding
Link copied to clipboard
common
inline fun <T : Any> SearchDSL.binding(tag: Any? = null): SearchDSL.Binding
Creates a return type constrained spec.
bindInstance
Link copied to clipboard
common
inline fun <T : Any> DI.Builder.bindInstance(tag: Any? = null, overrides: Boolean? = null, creator: () -> T)
Binds an instance provider: will always return the given instance.
bindMultiton
Link copied to clipboard
common
inline fun <A : Any, T : Any> DI.Builder.bindMultiton(tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true, noinline creator: DirectDI.(A) -> T)
Binds a multiton: will create an instance on first request and will subsequently always return the same instance.
bindProvider
Link copied to clipboard
common
inline fun <T : Any> DI.Builder.bindProvider(tag: Any? = null, overrides: Boolean? = null, noinline creator: DirectDI.() -> T)
Creates a factory: each time an instance is needed, the function creator function will be called.
bindSet
Link copied to clipboard
common
inline fun <T : Any> DI.Builder.bindSet(tag: Any? = null, overrides: Boolean? = null)
Creates a set: multiple bindings can be added in this set.
bindSingleton
Link copied to clipboard
common
inline fun <T : Any> DI.Builder.bindSingleton(tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true, noinline creator: DirectDI.() -> T)
Binds a singleton: will create an instance on first request and will subsequently always return the same instance.
Constant
Link copied to clipboard
common
inline fun <T : Any> DIAware.constant(): DIProperty<T>
Gets a constant of type T and tag whose tag is the name of the receiving property.
context
Link copied to clipboard
common
inline fun <T : Any> SearchDSL.context(): SearchDSL.Spec
Creates a context constrained spec.
contexted
Link copied to clipboard
common
inline fun <C : Any> DI.Builder.contexted(): DI.BindBuilder<C>
Used to define bindings with a context: bind<MyType>() with contexted<MyContext>().provider { /*...*/ }
contextFinder
Link copied to clipboard
common
inline fun <S : Any> contextFinder(noinline t: DirectDI.() -> S): ContextTranslator<Any, S>
contextTranslator
Link copied to clipboard
common
inline fun <C : Any, S : Any> contextTranslator(noinline t: DirectDI.(C) -> S?): ContextTranslator<C, S>
description
Link copied to clipboard
common
fun BindingsMap.description(withOverrides: Boolean = false, ident: Int = 8): String
The description of all bindings in this map, using type simple display names.
diContext
Link copied to clipboard
common
inline fun <C : Any> diContext(context: C): DIContext<C>
Defines a context and its type to be used by DI.
inline fun <C : Any> diContext(crossinline getContext: () -> C): DIContext<C>
Defines a context and its type to be used by DI.
eagerSingleton
Link copied to clipboard
common
inline fun <T : Any> DI.Builder.eagerSingleton(noinline creator: NoArgBindingDI<Any>.() -> T): EagerSingleton<T>
Creates an eager singleton: will create an instance as soon as kodein is ready (all bindings are set) and will always return this instance.
erasedList
Link copied to clipboard
common
inline fun <T : Any> erasedList(): TypeToken<List<T>>
Creates a CompositeTypeToken that defines a List<T>.
erasedMap
Link copied to clipboard
common
inline fun <K : Any, V : Any> erasedMap(): TypeToken<Map<K, V>>
Creates a CompositeTypeToken that defines a Map<K, V>.
erasedSet
Link copied to clipboard
common
inline fun <T : Any> erasedSet(): TypeToken<Set<T>>
Creates a CompositeTypeToken that defines a Set<T>.
Factory
Link copied to clipboard
common
inline fun <A : Any, T : Any> Named.factory(): DIProperty<(A) -> T>
Gets a factory of T for the given argument type and return type.
common
inline fun <C : Any, A : Any, T : Any> DI.BindBuilder<C>.factory(noinline creator: BindingDI<C>.(A) -> T): Factory<C, A, T>
Creates a factory: each time an instance is needed, the function creator function will be called.
common
inline fun <A : Any, T : Any> DIAware.factory(tag: Any? = null): DIProperty<(A) -> T>
Gets a factory of T for the given argument type, return type and tag.
inline fun <A : Any, T : Any> DirectDI.factory(tag: Any? = null): (A) -> T
Gets a factory of T for the given argument type, return type and tag.
common
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
common
inline fun <A : Any, T : Any> Named.factoryOrNull(): DIProperty<(A) -> T?>
Gets a factory of T for the given argument type and return type, or nul if none is found.
inline fun <A : Any, T : Any> DIAware.factoryOrNull(tag: Any? = null): DIProperty<(A) -> T?>
Gets a factory of T for the given argument type, return type and tag, or nul if none is found.
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.
findAllBindings
Link copied to clipboard
common
fun DITree.findAllBindings(f: FindDSL.() -> Unit): List<Triple<DI.Key<*, *, *>, List<DIDefinition<*, *, *>>, ContextTranslator<*, *>?>>
Used to find bindings that match a particular SearchSpecs.
fullDescription
Link copied to clipboard
common
fun BindingsMap.fullDescription(withOverrides: Boolean = false, ident: Int = 8): String
The description of all bindings in this map, using type full display names.
inSet
Link copied to clipboard
common
inline fun <T : Any> DI.Builder.TypeBinder<T>.inSet(): TypeBinderInSet<T, Set<T>>
Defines that the binding will be saved in a set binding.
inline fun <T : Any> DI.Builder.inSet(tag: Any? = null, overrides: Boolean? = null, creator: () -> DIBinding<*, *, T>)
Defines that the binding will be saved in a set binding.
Instance
Link copied to clipboard
common
inline fun <T : Any> Named.instance(): DIProperty<T>
Gets an instance of T for the given type.
inline fun <T : Any> DI.Builder.instance(instance: T): InstanceBinding<T>
Creates an instance provider: will always return the given instance.
inline fun <T : Any> DIAware.instance(tag: Any? = null): DIProperty<T>
Gets an instance of T for the given type and tag.
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> Named.instance(arg: A): DIProperty<T>
Gets an instance of T for the given type, curried from a factory that takes an argument A.
inline fun <A : Any, T : Any> Named.instance(noinline fArg: () -> A): DIProperty<T>
Gets an instance of T for the given type, curried from a factory that takes an argument A.
inline fun <A, T : Any> Named.instance(arg: Typed<A>): DIProperty<T>
Gets an instance of T for the given type, curried from a factory that takes an argument A.
inline fun <A : Any, T : Any> DIAware.instance(tag: Any? = null, arg: A): DIProperty<T>
Gets an instance of T for the given type and tag, curried from a factory that takes an argument A.
inline fun <A : Any, T : Any> DIAware.instance(tag: Any? = null, noinline fArg: () -> A): DIProperty<T>
Gets an instance of T for the given type and tag, curried from a factory that takes an argument A.
inline fun <A, T : Any> DIAware.instance(tag: Any? = null, arg: Typed<A>): DIProperty<T>
Gets an instance of T for the given type and tag, curried from a factory that takes an argument A.
inline fun <A : Any, T : Any> DirectDIAware.instance(tag: Any? = null, arg: A): T
Gets an instance of T for the given type and tag, curried from a factory for the given argument.
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
common
inline fun <T : Any> Named.instanceOrNull(): DIProperty<T?>
Gets an instance of T for the given type, or null if none is found.
inline fun <T : Any> DIAware.instanceOrNull(tag: Any? = null): DIProperty<T?>
Gets an instance of T for the given type and tag, or null if none is found.
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> Named.instanceOrNull(arg: A): DIProperty<T?>
Gets an instance of T for the given type, curried from a factory that takes an argument A, or null if none is found.
inline fun <A : Any, T : Any> Named.instanceOrNull(noinline fArg: () -> A): DIProperty<T?>
Gets an instance of T for the given type, curried from a factory that takes an argument A, or null if none is found.
inline fun <A, T : Any> Named.instanceOrNull(arg: Typed<A>): DIProperty<T?>
Gets an instance of T for the given type, curried from a factory that takes an argument A, or null if none is found.
inline fun <A : Any, T : Any> DIAware.instanceOrNull(tag: Any? = null, arg: A): DIProperty<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.
inline fun <A : Any, T : Any> DIAware.instanceOrNull(tag: Any? = null, noinline fArg: () -> A): DIProperty<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.
inline fun <A, T : Any> DIAware.instanceOrNull(tag: Any? = null, arg: Typed<A>): DIProperty<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.
inline fun <A : Any, T : Any> DirectDIAware.instanceOrNull(tag: Any? = null, arg: 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.
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.
multiton
Link copied to clipboard
common
inline fun <C : Any, A : Any, T : Any> DI.BindBuilder.WithScope<C>.multiton(ref: RefMaker? = null, sync: Boolean = true, noinline creator: BindingDI<C>.(A) -> T): Multiton<C, A, T>
Creates a multiton: will create an instance on first request for each different argument and will subsequently always return the same instance for the same argument.
newInstance
Link copied to clipboard
common
fun <T> DIAware.newInstance(creator: DirectDI.() -> T): DIProperty<T>
Allows to create a new instance of an unbound object with the same API as when bounding one.
inline fun <T> DirectDIAware.newInstance(creator: DirectDI.() -> T): T
Allows the creation of a new instance with DI injection.
On
Link copied to clipboard
common
fun DIAware.on(trigger: DITrigger?): DI
Allows to create a new DI object with a trigger set.
inline fun <C : Any> DirectDIAware.on(context: C): DirectDI
Returns a DirectDI with its context and/or receiver changed.
inline fun <C : Any> DIAware.on(context: C, trigger: DITrigger? = this.diTrigger): DI
Allows to create a new DI object with a context and/or a trigger set.
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.
Provider
Link copied to clipboard
common
inline fun <T : Any> Named.provider(): DIProperty<() -> T>
Gets a provider of T for the given type.
inline fun <C : Any, T : Any> DI.BindBuilder<C>.provider(noinline creator: NoArgBindingDI<C>.() -> T): Provider<C, T>
Creates a factory: each time an instance is needed, the function creator function will be called.
inline fun <T : Any> DIAware.provider(tag: Any? = null): DIProperty<() -> T>
Gets a provider of T for the given type and tag.
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> Named.provider(arg: A): DIProperty<() -> T>
Gets a provider of T for the given type, curried from a factory that takes an argument A.
inline fun <A : Any, T : Any> Named.provider(noinline fArg: () -> A): DIProperty<() -> T>
Gets a provider of T for the given type, curried from a factory that takes an argument A.
inline fun <A : Any, T : Any> Named.provider(arg: Typed<A>): DIProperty<() -> T>
Gets a provider of T for the given type, curried from a factory that takes an argument A.
inline fun <A : Any, T : Any> DIAware.provider(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.
inline fun <A : Any, T : Any> DIAware.provider(tag: Any? = null, noinline fArg: () -> A): DIProperty<() -> T>
Gets a provider of T for the given type and tag, curried from a factory that takes an argument A.
inline fun <A, T : Any> DIAware.provider(tag: Any? = null, arg: Typed<A>): DIProperty<() -> T>
Gets a provider of T for the given type and tag, curried from a factory that takes an argument A.
inline fun <A : Any, T : Any> DirectDIAware.provider(tag: Any? = null, arg: A): () -> T
Gets a provider of T for the given type and tag, curried from a factory for the given argument.
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.
inline fun <A, T : Any> DirectDIAware.provider(tag: Any? = null, arg: Typed<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
common
inline fun <T : Any> Named.providerOrNull(): DIProperty<() -> T?>
Gets a provider of T for the given type, or null if none is found.
inline fun <T : Any> DIAware.providerOrNull(tag: Any? = null): DIProperty<() -> T?>
Gets a provider of T for the given type and tag, or null if none is found.
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> Named.providerOrNull(arg: A): DIProperty<() -> T?>
Gets a provider of T for the given type, curried from a factory that takes an argument A, or null if none is found.
inline fun <A : Any, T : Any> Named.providerOrNull(noinline fArg: () -> A): DIProperty<() -> T?>
Gets a provider of T for the given type, curried from a factory that takes an argument A, or null if none is found.
inline fun <A, T : Any> Named.providerOrNull(arg: Typed<A>): DIProperty<() -> T?>
Gets a provider of T for the given type, curried from a factory that takes an argument A, or null if none is found.
inline fun <A : Any, T : Any> DIAware.providerOrNull(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, or null if none is found.
inline fun <A : Any, T : Any> DIAware.providerOrNull(tag: Any? = null, noinline fArg: () -> A): DIProperty<() -> 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.
inline fun <A, T : Any> DIAware.providerOrNull(tag: Any? = null, arg: Typed<A>): DIProperty<() -> 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.
inline fun <A : Any, T : Any> DirectDIAware.providerOrNull(tag: Any? = null, arg: 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.
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.
inline fun <A, T : Any> DirectDIAware.providerOrNull(tag: Any? = null, arg: Typed<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.
registerContextFinder
Link copied to clipboard
common
inline fun <S : Any> DI.Builder.registerContextFinder(noinline t: DirectDI.() -> S)
registerContextTranslator
Link copied to clipboard
common
inline fun <C : Any, S : Any> DI.Builder.registerContextTranslator(noinline t: DirectDI.(C) -> S?)
scoped
Link copied to clipboard
common
inline fun <C : Any> DI.Builder.scoped(scope: Scope<C>): DI.BindBuilder.WithScope<C>
Used to define bindings with a scope: bind<MyType>() with scoped(myScope).singleton { /*...*/ }
setBinding
Link copied to clipboard
common
inline fun <T : Any> DI.Builder.setBinding(): SetBinding<Any, T>
Creates a set: multiple bindings can be added in this set.
singleton
Link copied to clipboard
common
inline fun <C : Any, T : Any> DI.BindBuilder.WithScope<C>.singleton(ref: RefMaker? = null, sync: Boolean = true, noinline creator: NoArgBindingDI<C>.() -> T): Singleton<C, T>
Creates a singleton: will create an instance on first request and will subsequently always return the same instance.
subDI
Link copied to clipboard
common
inline fun subDI(parentDI: DI, allowSilentOverride: Boolean = false, copy: Copy = Copy.NonCached, crossinline init: DI.MainBuilder.() -> Unit): LazyDI
Allow to create an extended version of a given DI container
toProvider
Link copied to clipboard
common
inline fun <A, T : Any> (A) -> T.toProvider(crossinline arg: () -> A): () -> T
Transforms a factory function into a provider function by currying the factory with the given argument.
TTOf
Link copied to clipboard
common
fun <T : Any> TTOf(obj: T): TypeToken<out T>
Returns a type token representing the actual type of the given argument.
with
Link copied to clipboard
common
infix inline fun <T : Any> DI.Builder.ConstantBinder.with(value: T)
Binds the previously given tag to the given instance.
infix inline fun <C : Any, A : Any, T : Any> TypeBinderSubTypes<T>.with(noinline block: (TypeToken<out T>) -> DIBinding<in C, in A, out T>)
Allows to define a binding that will be called for any subtype of this type.

Properties

direct
Link copied to clipboard
common
val DIAware.direct: DirectDI
Return a direct DirectDI instance, with its receiver and context set to this DIAware receiver and context.
lazy
Link copied to clipboard
common
val DirectDIAware.lazy: DI
Returns a regular DI instance (DI is lazy by default).
named
Link copied to clipboard
common
val DIAware.named: Named
Allows to get factories / providers / instances with a tag set to the name of the receiving property.