EagerSingleton

class EagerSingleton<T : Any>(builder: DIContainer.Builder, val createdType: TypeToken<out T>, val 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

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

Properties

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

The type of the argument this factory will function for.

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

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

Link copied to clipboard
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.

Link copied to clipboard
open override val createdType: TypeToken<out T>
Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard

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

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

The scope used by this factory, if any

Link copied to clipboard

Whether this bindings supports subtype handling.

Functions

Link copied to clipboard

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

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

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

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