Factory

class Factory<C : Any, A, T : Any>(contextType: TypeToken<in C>, argType: TypeToken<in A>, createdType: TypeToken<out T>, creator: BindingDI<C>.(A) -> T) : DIBinding<C, A, T>

Concrete factory: each time an instance is needed, the function creator function will be called.

Parameters

A

The argument type.

T

The created type.

argType

The type of the argument used by this factory.

createdType

The type of objects created by this factory.

Constructors

Factory
Link copied to clipboard
common
fun <C : Any, A, T : Any> Factory(contextType: TypeToken<in C>, argType: TypeToken<in A>, createdType: TypeToken<out T>, creator: BindingDI<C>.(A) -> T)
The argument type.

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<C, A, T>, di: BindingDI<C>): (A) -> T
Returns a factory for the given key.

Properties

argType
Link copied to clipboard
common
open override val argType: TypeToken<in A>
The type of the argument used by this factory.
contextType
Link copied to clipboard
common
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
common
open val copier: DIBinding.Copier<C, A, T>?
A copier that is responsible for copying / resetting the binding.
createdType
Link copied to clipboard
common
open override val createdType: TypeToken<out T>
The type of objects created by this factory.
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<C>?
The scope used by this factory, if any
supportSubTypes
Link copied to clipboard
common
open val supportSubTypes: Boolean
Whether this bindings supports subtype handling.