kapsule-core / space.traversal.kapsule

Package space.traversal.kapsule

Kapsule API

Types

Delegate

sealed class Delegate<in M, T>

Kapsule property delegate.

HasModules

interface HasModules

Module with other submodules attached via delegation.

Injects

interface Injects<M>

Injection interface.

Kapsule

class Kapsule<M>

Kapsule injector.

Kapsules

object Kapsules

Static storage of Kapsule instances.

Exceptions

TransitiveInjectionException

class TransitiveInjectionException : ClassCastException

Class cast exception indicating that a submodule depends on a module that is not a descendant of the root module.

Functions

inject

fun <M> Injects<M>.inject(module: M): Unit

Fetches Kapsule instance and calls Kapsule.inject.

optional

fun <M, T> Injects<M>.optional(initializer: M.() -> T?): Optional<M, T>

Fetches Kapsule instance and calls Kapsule.optional.

required

fun <M, T> Injects<M>.required(initializer: M.() -> T): Required<M, T>

Fetches Kapsule instance and calls Kapsule.required.

transitive

fun <M : HasModules> M.transitive(): M

Injects root module into any submodules with transitive dependencies.