Kontainer

class Kontainer

The container

Functions

clone
Link copied to clipboard
fun clone(): Kontainer
Create a new fresh instance of this Kontainer.
debugInfo
Link copied to clipboard
fun debugInfo(): KontainerDebugInfo
dump
Link copied to clipboard
fun dump(): String
get
Link copied to clipboard
inline fun <T : Any> get(): T
Get a service for the given class
fun <T : Any> get(cls: KClass<T>): T
Get a service for the given class
getAll
Link copied to clipboard
fun <T : Any> getAll(cls: KClass<T>): List<T>
Get all services that are a super type of the given class
getCandidates
Link copied to clipboard
fun <T : Any> getCandidates(cls: KClass<T>): Set<KClass<*>>
Get all service classes that would satisfy the given cls
getConfig
Link copied to clipboard
fun <T> getConfig(id: String): T
Get a config value by its id
getLookup
Link copied to clipboard
fun <T : Any> getLookup(cls: KClass<T>): Lookup<T>
Get all services that are a super type of the given class as a Lookup
getOrNull
Link copied to clipboard
fun <T : Any> getOrNull(cls: KClass<T>): T?
Get a service for the given cls or null if no service can be provided
getProvider
Link copied to clipboard
inline fun <T : Any> getProvider(): ServiceProvider
Get a provider for the given service class
fun <T : Any> getProvider(cls: KClass<T>): ServiceProvider
Get a provider for the given service class
hasConfig
Link copied to clipboard
fun hasConfig(id: String, type: KClass<*>): Boolean
Check if there is a config value with the given id that is of the given type
use
Link copied to clipboard
fun <T : Any, R> use(cls: KClass<T>, block: T.() -> R?): R?
Get a service for the given cls, and when it is present run the block on it.

Properties

blueprint
Link copied to clipboard
val blueprint: KontainerBlueprint
The blueprint for this kontainer
providers
Link copied to clipboard
val providers: Map<KClass<*>, ServiceProvider>
Class to service provider map