winter / io.jentz.winter / Component / Builder

Builder

class Builder

Types

SubcomponentIncludeMode

enum class SubcomponentIncludeMode

Properties

qualifier

val qualifier: Any

Functions

alias

fun <R0 : Any, R1 : Any> alias(targetKey: TypeKey<R0>, newKey: TypeKey<R1>, override: Boolean = false): TypeKey<R0>

Create an alias entry.

fun <R : Any> TypeKey<*>.alias(aliasQualifier: Any? = null, generics: Boolean = false, override: Boolean = false): TypeKey<*>

Create an alias entry for a TypeKey.

allowComponentQualifier

fun allowComponentQualifier(qualifier: Any, block: () -> Unit): Unit

Allow a different component qualifier than qualifier for include and Factory.register.

checkComponentQualifier

fun checkComponentQualifier(qualifier: Any): Unit

Checks if the given qualifier meets criteria for include and Factory.register.

constant

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

Register a constant of type R.

eagerSingleton

fun <R : Any> eagerSingleton(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false, onPostConstruct: GFactoryCallback<R>? = null, onClose: GFactoryCallback<R>? = null, factory: GFactory<R>): TypeKey<R>

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

generated

fun <R : Any> generated(override: Boolean = false): TypeKey<R>

Register a generated factory.

generatedFactory

fun <R : Any> generatedFactory(): Factory<R>

Loads the generated factory of the given type.

include

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

Include dependency from the given component into the new component.

mapOfProvidersForType

fun <R : Any> mapOfProvidersForType(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false, defaultKey: Any = "default"): TypeKey<Map<Any, Provider<R>>>

Register a service that resolves a map of qualifiers to providers for type R.

mapOfType

fun <R : Any> mapOfType(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false, defaultKey: Any = "default"): TypeKey<Map<Any, R>>

Register a service that resolves a map of qualifiers to type R.

prototype

fun <R : Any> prototype(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false, onPostConstruct: GFactoryCallback<R>? = null, factory: GFactory<R>): TypeKey<R>

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.

setOfProvidersForType

fun <R : Any> setOfProvidersForType(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false): TypeKey<Set<Provider<R>>>

Register a service that resolves a set of providers for type R.

setOfType

fun <R : Any> setOfType(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false): TypeKey<Set<R>>

Register a service that resolves a set of instance of type R.

singleton

fun <R : Any> singleton(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false, onPostConstruct: GFactoryCallback<R>? = null, onClose: GFactoryCallback<R>? = null, factory: GFactory<R>): TypeKey<R>

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, onPostConstruct: GFactoryCallback<R>? = null, factory: GFactory<R>): TypeKey<R>

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

subcomponent

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

Register a subcomponent.

weakSingleton

fun <R : Any> weakSingleton(qualifier: Any? = null, generics: Boolean = false, override: Boolean = false, onPostConstruct: GFactoryCallback<R>? = null, factory: GFactory<R>): TypeKey<R>

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