object Winter : WinterApplication
The default WinterApplication object.
It is recommended for applications to use this directly and for libraries it is recommended to create a library specific object based on WinterApplication.
Example:
// configure application component
Winter.component {
// ... dependency declaration
}
// install RxJava 2 disposable plugin
Winter.installDisposablePlugin()
// configure injection adapter.
Winter.useAndroidPresentationScopeInjectionAdapter()
// open the application dependency graph
Winter.openGraph()
See Also
var checkForCyclicDependencies: Boolean
If this is set to true, Winter will check for cyclic dependencies and throws an error if it encounters one. Without this check you will run in a StackOverflowError when you accidentally declared a cyclic dependency which may be hard to track down. |
|
var component: Component
The application component. |
|
val graph: Graph
Get the application graph. |
|
var graphOrNull: Graph?
Get the application graph if open otherwise null. |
|
var injectionAdapter: WinterApplication.InjectionAdapter?
The application injection adapter. |
|
var plugins: Plugins
The plugins registered on the application. |
fun closeGraph(): Unit
Close the application graph. |
|
fun closeGraphIfOpen(): Unit
Close the application graph if open otherwise do nothing. |
|
fun component(qualifier: Any = ApplicationScope::class, block: ComponentBuilderBlock): Unit
Sets the application component by supplying an optional qualifier and a component builder block. |
|
fun createGraph(block: ComponentBuilderBlock? = null): Graph
Create graph from component without registering it as application graph. |
|
fun getOrOpenGraph(block: ComponentBuilderBlock? = null): Graph
Get application graph if already open otherwise open and return it. |
|
fun inject(instance: Any): Unit
Inject dependencies into instance by using the dependency graph returned from InjectionAdapter.get called with instance. fun inject(instance: Any, target: Any): Unit
Inject dependencies with dependency graph from instance into target. This uses the dependency graph returned from InjectionAdapter.get called with instance. |
|
fun openGraph(block: ComponentBuilderBlock? = null): Graph
Open the application component. |
fun WinterApplication.useApplicationGraphOnlyAdapter(): Unit
Register an ApplicationGraphOnlyInjectionAdapter on this WinterApplication instance. |