ConstantService

class ConstantService<R>(val key: TypeKey<R>, val value: R) : BoundService<R> , UnboundService<R> (source)

Constructors

Link copied to clipboard
constructor(key: TypeKey<R>, value: R)

Properties

Link copied to clipboard
open override val key: TypeKey<R>

The TypeKey of the type this service is providing.

Link copied to clipboard

Return true if the bound service requires a call to BoundService.onPostConstruct after constructing.

Link copied to clipboard
open override val scope: Qualifier

A scope that is unique for this type of service e.g. Prototype/Singleton.

Link copied to clipboard
val value: R

Functions

Link copied to clipboard
open override fun bind(graph: Graph): BoundService<R>

Returns a BoundService for this UnboundService.

Link copied to clipboard
fun <R> BoundService<R>.checkedInstance(isOptional: Boolean, block: ComponentBuilderBlock? = null): R
Link copied to clipboard
open override fun instance(block: ComponentBuilderBlock? = null): R

This is called every time an instance is requested from the Graph. Calls to this might not be synchronized.

Link copied to clipboard
open override fun newInstance(graph: Graph): R

This is called when this instance is passed to Graph.evaluate to create a new instance.

Link copied to clipboard
open fun onClose()

This is called for each BoundService in a Graph when Graph.close is called.

Link copied to clipboard
open fun onPostConstruct(graph: Graph, instance: R)

This is called after a new instance was created but not until the complete dependency request is finished.