winter / io.jentz.winter / WinterInjection / createGraphAndInject

createGraphAndInject

fun createGraphAndInject(instance: Any, injector: Injector, block: ComponentBuilderBlock? = null): Graph

Create and return dependency graph for instance and also pass the graph to the given injector.

Parameters

instance - The instance for which a graph should be created.

injector - The injector to inject into.

block - An optional builder block to pass to the component createGraph method.

Exceptions

io.jentz.winter.WinterException - if given instance type is not supported.

Return
The created dependency graph.

fun <T : Any> createGraphAndInject(instance: T, injectSuperClasses: Boolean = false, block: ComponentBuilderBlock? = null): Graph

Create and return dependency graph for instance and inject all members into instance.

This is useful in conjunction with JSR330 Inject annotations.

Parameters

instance - The instance to create a graph for and to inject into.

injectSuperClasses - If true this will look for members injectors for super classes too.

block - An optional builder block to pass to the component createGraph method.

Exceptions

io.jentz.winter.WinterException - if given instance type is not supported.

Return
The created dependency graph.