open class WinterInjection
Abstraction to create, get and dispose a dependency graph from a class that can't make use of constructor injection.
For applications it is recommended to use the object version Injection directly and for libraries it is recommended to create a object version from WinterInjection instead.
See Also
interface Adapter
Adapter interface to provide application specific graph creation and retrieval strategy. |
WinterInjection()
Abstraction to create, get and dispose a dependency graph from a class that can't make use of constructor injection. |
var adapter: WinterInjection.Adapter
Set the application specific adapter. |
fun createGraph(instance: Any, block: ComponentBuilderBlock? = null): Graph
Create and return dependency graph for instance. |
|
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. 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. |
|
fun disposeGraph(instance: Any): Unit
Dispose the dependency graph of the given instance. |
|
fun getGraph(instance: Any): Graph
Get dependency graph for instance. |
|
fun inject(instance: Any, injector: Injector): Unit
Get dependency graph for given instance and inject dependencies into injector. fun <T : Any> inject(instance: T, injectSuperClasses: Boolean = false): Unit
Inject into instance by using the dependency graph of the instance. This uses MembersInjector and is useful in conjunction with Winters JSR330 annotation processor. |
fun WinterInjection.useApplicationGraphOnlyAdapter(tree: WinterTree = GraphRegistry): Unit fun WinterInjection.useApplicationGraphOnlyAdapter(application: WinterApplication): Unit
Register an ApplicationGraphOnlyAdapter on this WinterInjection instance. |
object Injection : WinterInjection
Abstraction to create, get and dispose a dependency graph from a class that can't make use of constructor injection. This takes the burden off of the class to know how exactly a graph or parent graph is stored and how to create and store a new graph. |