winter / io.jentz.winter / Winter

Winter

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

WinterApplication

Inherited Properties

checkForCyclicDependencies

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.

component

var component: Component

The application component.

graph

val graph: Graph

Get the application graph.

graphOrNull

var graphOrNull: Graph?

Get the application graph if open otherwise null.

injectionAdapter

var injectionAdapter: WinterApplication.InjectionAdapter?

The application injection adapter.

plugins

var plugins: Plugins

The plugins registered on the application.

Inherited Functions

closeGraph

fun closeGraph(): Unit

Close the application graph.

closeGraphIfOpen

fun closeGraphIfOpen(): Unit

Close the application graph if open otherwise do nothing.

component

fun component(qualifier: Any = ApplicationScope::class, block: ComponentBuilderBlock): Unit

Sets the application component by supplying an optional qualifier and a component builder block.

createGraph

fun createGraph(block: ComponentBuilderBlock? = null): Graph

Create graph from component without registering it as application graph.

getOrOpenGraph

fun getOrOpenGraph(block: ComponentBuilderBlock? = null): Graph

Get application graph if already open otherwise open and return it.

inject

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.

openGraph

fun openGraph(block: ComponentBuilderBlock? = null): Graph

Open the application component.

Extension Functions

useApplicationGraphOnlyAdapter

fun WinterApplication.useApplicationGraphOnlyAdapter(): Unit

Register an ApplicationGraphOnlyInjectionAdapter on this WinterApplication instance.