commonMain.org.kodein.di.DITree.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kodein-di-js Show documentation
Show all versions of kodein-di-js Show documentation
KODEIN Dependency Injection Core
package org.kodein.di
import org.kodein.di.bindings.ContextTranslator
import org.kodein.di.bindings.ExternalSource
/**
* Tree where the bindings and their factories are sorted & stored.
*/
public interface DITree {
/**
* An immutable view of the bindings map. *For inspection & debug*.
*/
public val bindings: BindingsMap
public val registeredTranslators: List>
/**
* The external sources that will be queried if no bindings are found for a given request.
*/
public val externalSources: List
/**
* Finds all keys and definitions that match the given key.
*
* If a "perfect" match is found (a definition that exactly matches the given key), only that definition is returned, unless [all] is true.
*
* @param C The key context type.
* @param A The key argument type.
* @param T The key return type.
* @param key The key to look for.
* @param overrideLevel 0 if looking for regular bindings, 1 or more if looking for bindings that have been overridden.
* @return A list of keys and their definition.
*/
public fun find(key: DI.Key, overrideLevel: Int = 0, all: Boolean = false): List, DIDefinition, ContextTranslator?>>
/**
* Finds all keys and definitions that match the given specs.
*
* @return A list of keys and their definition.
*/
public fun find(search: SearchSpecs): List, List>, ContextTranslator<*, *>?>>
/**
* Gets a List of definition for an exact key representing a binding and all its overrides.
*
* @param C The key context type.
* @param A The key argument type.
* @param T The key return type.
* @param key The exact key to look for.
* @return The binding and all it's overrides, or null if this key is not registered.
*/
public operator fun get(key: DI.Key): Triple, List>, ContextTranslator?>?
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy