winter / io.jentz.winter / ComponentBuilder

ComponentBuilder

class ComponentBuilder

Component builder DSL.

Types

SubcomponentIncludeMode

enum class SubcomponentIncludeMode

Properties

qualifier

val qualifier: Any?

Functions

alias

fun alias(targetKey: TypeKey, newKey: TypeKey, override: Boolean = false): Unit

Create an alias entry.

constant

fun <T : Any> constant(value: T, qualifier: Any? = null, generics: Boolean = false, override: Boolean = false): Unit

Register a constant of type T.

eagerSingleton

fun <R : Any> eagerSingleton(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false, postConstruct: GFactoryCallback1<R>? = null, dispose: GFactoryCallback1<R>? = null, factory: GFactory0<R>): Unit

Register an eager singleton scoped factory for an instance of type R.

factory

fun <A : Any, R : Any> factory(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false, postConstruct: GFactoryCallback2<A, R>? = null, factory: GFactory1<A, R>): Unit

Register a factory from type (A) -> R.

include

fun include(component: Component, override: Boolean = true, subcomponentIncludeMode: ComponentBuilder.SubcomponentIncludeMode = SubcomponentIncludeMode.Merge): Unit

Include dependency from the given component into the new component.

membersInjector

fun <R : Any> membersInjector(provider: Provider<MembersInjector<R>>): Unit

Register a members injector for R.

multiton

fun <A : Any, R : Any> multiton(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false, postConstruct: GFactoryCallback2<A, R>? = null, dispose: GFactoryCallback2<A, R>? = null, factory: GFactory1<A, R>): Unit

Register a multiton factory from type (A) -> R.

prototype

fun <R : Any> prototype(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false, postConstruct: GFactoryCallback1<R>? = null, factory: GFactory0<R>): Unit

Register a prototype scoped factory for an instance of type R.

register

fun register(service: UnboundService<*, *>, override: Boolean): Unit

Register a UnboundService.

remove

fun remove(key: TypeKey, silent: Boolean = false): Unit

Remove a dependency from the component. Throws an EntryNotFoundException if the dependency doesn't exist and silent is false.

singleton

fun <R : Any> singleton(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false, postConstruct: GFactoryCallback1<R>? = null, dispose: GFactoryCallback1<R>? = null, factory: GFactory0<R>): Unit

Register a singleton scoped factory for an instance of type R.

softSingleton

fun <R : Any> softSingleton(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false, postConstruct: GFactoryCallback1<R>? = null, factory: GFactory0<R>): Unit

Register a soft singleton scoped factory for an instance of type R.

subcomponent

fun subcomponent(qualifier: Any, override: Boolean = false, deriveExisting: Boolean = false, block: ComponentBuilder.() -> Unit): Unit

Register a subcomponent.

weakSingleton

fun <R : Any> weakSingleton(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false, postConstruct: GFactoryCallback1<R>? = null, factory: GFactory0<R>): Unit

Register a weak singleton scoped factory for an instance of type R.