Multiton

class Multiton<C : Any, A, T : Any>(scope: Scope<C>, contextType: TypeToken<in C>, explicitContext: Boolean, argType: TypeToken<in A>, createdType: TypeToken<out T>, refMaker: RefMaker?, sync: Boolean, creator: BindingDI<C>.(A) -> T) : DIBinding<C, A, T>

Concrete multiton: will create one and only one instance for each argument. Will create the instance on first time a given argument is used and will subsequently always return the same instance for the same argument.

Parameters

T

The created type.

Constructors

Multiton
Link copied to clipboard
fun <C : Any, A, T : Any> Multiton(scope: Scope<C>, contextType: TypeToken<in C>, explicitContext: Boolean, argType: TypeToken<in A>, createdType: TypeToken<out T>, refMaker: RefMaker? = null, sync: Boolean = true, creator: BindingDI<C>.(A) -> T)

Functions

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

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

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

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

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

Returns a factory for the given key. A factory is a function that returns an instance of type T function argument A.

Properties

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

The type of the argument used for each value can there be a new instance.

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

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

copier
Link copied to clipboard
open override val copier: DIBinding.Copier<C, A, 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
open override val createdType: TypeToken<out T>

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

description
Link copied to clipboard
open val description: String

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

fullDescription
Link copied to clipboard
open val fullDescription: String

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

scope
Link copied to clipboard
open override val scope: Scope<C>

The scope used by this factory, if any

supportSubTypes
Link copied to clipboard
open val supportSubTypes: Boolean

Whether this bindings supports subtype handling.

sync
Link copied to clipboard
val sync: Boolean = true