Graph

class Graph(source)

The object graph class that retrieves and instantiates dependencies registered in its component.

An instance is created by calling Component.createGraph or Graph.createSubgraph.

Properties

Link copied to clipboard

A sequence of all ancestors. This returns a empty Sequence if this is a root Graph.

Link copied to clipboard
Link copied to clipboard

The Component instance.

Link copied to clipboard

Indicates if the graph is closed.

Link copied to clipboard

The parent Graph instance or null if no parent exists.

Link copied to clipboard

Get parent Graph.

Link copied to clipboard

The root Graph. This returns itself if Graph.parent is null.

Link copied to clipboard

Sequence with all ancestors and this Graph starting with this up the parent hierarchy.

Functions

Link copied to clipboard
Link copied to clipboard
fun close()

Runs graph close plugins and marks this graph as closed. All resources get released and every retrieval method will throw an exception if called after closing.

Link copied to clipboard
fun createSubgraph(subcomponentQualifier: Qualifier, block: ComponentBuilderBlock? = null): Graph

Initialize and return a subgraph by using the subcomponent with subcomponentQualifier and this graph as parent.

Link copied to clipboard
fun <R> evaluate(service: BoundService<R>, block: ComponentBuilderBlock?): R

This is called from BoundService.instance when a new instance is created. Don't use this method except in custom BoundService implementations.

Link copied to clipboard
inline fun <R> instance(noinline block: ComponentBuilderBlock? = null): R
fun <R> instance(key: TypeKey<R>, block: ComponentBuilderBlock? = null): R

Retrieve an instance of type R.

Link copied to clipboard
fun Graph.keys(): Set<TypeKey<*>>

Returns a set of all keys registered on the backing Component and all the ancestor components.

Link copied to clipboard
inline fun <R> Graph.lazyInstance(noinline block: ComponentBuilderBlock? = null): Lazy<R>

Creates an instance of Lazy that resolves the service for R on first access.

fun <R> Graph.lazyInstance(key: TypeKey<R>, block: ComponentBuilderBlock? = null): Lazy<R>

Creates an instance of Lazy that resolves the service for key on first access.

Link copied to clipboard
inline fun <R : Any> Graph.new(noinline constructor: () -> R): R

Create an instance of type R. All arguments will be resolved from this graph.

inline fun <R : Any, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8, a9: A9) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8, a9: A9, a10: A10) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8, a9: A9, a10: A10, a11: A11) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8, a9: A9, a10: A10, a11: A11, a12: A12) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8, a9: A9, a10: A10, a11: A11, a12: A12, a13: A13) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8, a9: A9, a10: A10, a11: A11, a12: A12, a13: A13, a14: A14) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8, a9: A9, a10: A10, a11: A11, a12: A12, a13: A13, a14: A14, a15: A15) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8, a9: A9, a10: A10, a11: A11, a12: A12, a13: A13, a14: A14, a15: A15, a16: A16) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8, a9: A9, a10: A10, a11: A11, a12: A12, a13: A13, a14: A14, a15: A15, a16: A16, a17: A17) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8, a9: A9, a10: A10, a11: A11, a12: A12, a13: A13, a14: A14, a15: A15, a16: A16, a17: A17, a18: A18) -> R): R
inline fun <R : Any, A0> Graph.new(noinline constructor: (a0: A0) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8, a9: A9, a10: A10, a11: A11, a12: A12, a13: A13, a14: A14, a15: A15, a16: A16, a17: A17, a18: A18, a19: A19) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8, a9: A9, a10: A10, a11: A11, a12: A12, a13: A13, a14: A14, a15: A15, a16: A16, a17: A17, a18: A18, a19: A19, a20: A20) -> R): R
inline fun <R : Any, A0, A1> Graph.new(noinline constructor: (a0: A0, a1: A1) -> R): R
inline fun <R : Any, A0, A1, A2> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2) -> R): R
inline fun <R : Any, A0, A1, A2, A3> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4, A5> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4, A5, A6> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4, A5, A6, A7> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) -> R): R
inline fun <R : Any, A0, A1, A2, A3, A4, A5, A6, A7, A8> Graph.new(noinline constructor: (a0: A0, a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) -> R): R
Link copied to clipboard
inline fun <R> Graph.provider(noinline block: ComponentBuilderBlock? = null): Provider<R>

Creates a provider function that resolves the service of type R on every call.

fun <R> Graph.provider(key: TypeKey<R>, block: ComponentBuilderBlock? = null): Provider<R>

Creates a provider function that resolves the service for key on every call.

Link copied to clipboard
tailrec fun <R> service(key: TypeKey<R>, base: Graph? = this): BoundService<R>?