winter / io.jentz.winter / BoundService

BoundService

interface BoundService<R : Any>

Interface for bound service entries in a Graph.

Properties

key

abstract val key: TypeKey<R>

The TypeKey of the type this service is providing.

scope

abstract val scope: Scope

A scope that is unique for this type of service e.g. Scope("myCustomScope").

Functions

instance

abstract fun instance(): R

This is called every time an instance is requested from the Graph.

newInstance

abstract fun newInstance(): R

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

onClose

abstract fun onClose(): Unit

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

onPostConstruct

abstract fun onPostConstruct(instance: R): Unit

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