EagerSingleton

class EagerSingleton<T : Any>(builder: DIContainer.Builder, createdType: TypeToken<out T>, creator: NoArgBindingDI<Any>.() -> T) : NoArgDIBinding<Any, T>

Concrete eager singleton: will create an instance as soon as di is ready (all bindings are set) and will always return this instance.

Parameters

T

The created type.

createdType

The type of the created object.

creator

The function that will be called as soon as DI is ready. Guaranteed to be called only once. Should create a new instance.

Constructors

EagerSingleton
Link copied to clipboard
common
fun <T : Any> EagerSingleton(builder: DIContainer.Builder, createdType: TypeToken<out T>, creator: NoArgBindingDI<Any>.() -> T)

Functions

factoryFullName
Link copied to clipboard
common
open fun factoryFullName(): String

The full(er) name of this factory, used for debug print only.

factoryName
Link copied to clipboard
common
open override fun factoryName(): String

The name of this factory, used for debug print only.

getFactory
Link copied to clipboard
common
open override fun getFactory(key: DI.Key<Any, Unit, T>, di: BindingDI<Any>): (Unit) -> T

Properties

argType
Link copied to clipboard
common
open override val argType: TypeToken<Unit>

The type of the argument this factory will function for.

contextType
Link copied to clipboard
common
open override val contextType: TypeToken<Any>

The type of contexts that are to be set when using this factory.

copier
Link copied to clipboard
common
open override val copier: DIBinding.Copier<Any, Unit, T>

A copier that is responsible for copying / resetting the binding. If null, it means that the binding do not hold any reference or status and need not be copied.

createdType
Link copied to clipboard
common
open override val createdType: TypeToken<out T>
creator
Link copied to clipboard
common
val creator: NoArgBindingDI<Any>.() -> T
description
Link copied to clipboard
common
open val description: String

The description of this factory (using simple type names), used for debug print only.

fullDescription
Link copied to clipboard
common
open val fullDescription: String

The description of this factory (using full type names), used for debug print only.

scope
Link copied to clipboard
common
open val scope: Scope<Any>?

The scope used by this factory, if any

supportSubTypes
Link copied to clipboard
common
open val supportSubTypes: Boolean

Whether this bindings supports subtype handling.