BoundService

abstract class BoundService<R>(source)

Interface for bound service entries in a Graph.

Inheritors

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open 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 val scope: Qualifier

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

Functions

Link copied to clipboard
fun <R> BoundService<R>.checkedInstance(isOptional: Boolean, block: ComponentBuilderBlock? = null): R
Link copied to clipboard
abstract 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
abstract 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.