Singleton

fun <C : Any, T : Any> Singleton(scope: Scope<C>, contextType: TypeToken<in C>, explicitContext: Boolean, createdType: TypeToken<out T>, refMaker: RefMaker? = null, sync: Boolean = true, creator: NoArgBindingDI<C>.() -> T)

Parameters

T

The created type.

createdType

The type of the created object, used for debug print only.

creator

The function that will be called the first time an instance is requested. Guaranteed to be called only once. Should create a new instance.