winter / io.jentz.winter.aware

Package io.jentz.winter.aware

Types

WinterAware

interface WinterAware

Implementing this interface gives simpler syntax for dependency retrieval and is particularly useful in cases where constructor injection is not possible.

Functions

createGraph

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

Create and return dependency graph for this by using WinterAware.injection.

createGraphAndInject

fun WinterAware.createGraphAndInject(injector: Injector, block: ComponentBuilderBlock? = null): Graph

Create and return dependency graph for this and also pass the graph to the given injector by using WinterAware.injection.

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

Create and return dependency graph for this and inject all members into instance by using WinterAware.injection.

disposeGraph

fun WinterAware.disposeGraph(): Unit

Dispose the dependency graph of this by using WinterAware.injection.

factory

fun <A : Any, R : Any> WinterAware.factory(qualifier: Any? = null, generics: Boolean = false): Factory<A, R>

Retrieve a non-optional factory function that takes an argument of type A and returns R.

factoryOrNull

fun <A : Any, R : Any> WinterAware.factoryOrNull(qualifier: Any? = null, generics: Boolean = false): Factory<A, R>?

Retrieve an optional factory function that takes an argument of type A and returns R.

inject

fun WinterAware.inject(injector: Injector): Unit

Get dependency graph for this and inject dependencies into injector by using WinterAware.injection.

fun <T : Any> WinterAware.inject(instance: T, injectSuperClasses: Boolean = false): Unit

Inject into instance by using the dependency graph of this by using WinterAware.injection. This is useful in conjunction with Winters JSR330 annotation processor.

instance

fun <R : Any> WinterAware.instance(qualifier: Any? = null, generics: Boolean = false): R

Retrieve a non-optional instance of R.

fun <A, R : Any> WinterAware.instance(argument: A, qualifier: Any? = null, generics: Boolean = false): R

Retrieve a factory of type (A) -> R and apply argument to it.

instanceOrNull

fun <R : Any> WinterAware.instanceOrNull(qualifier: Any? = null, generics: Boolean = false): R?

Retrieve an optional instance of R.

fun <A, R : Any> WinterAware.instanceOrNull(argument: A, qualifier: Any? = null, generics: Boolean = false): R?

Retrieve an optional factory of type (A) -> R and apply argument to it.

instancesOfType

fun <R : Any> WinterAware.instancesOfType(generics: Boolean = false): Set<R>

Retrieve all instances of type R.

lazyInstance

fun <R : Any> WinterAware.lazyInstance(qualifier: Any? = null, generics: Boolean = false): Lazy<R>

Create a Lazy that retrieves an instance of R when initialized.

fun <A, R : Any> WinterAware.lazyInstance(argument: A, qualifier: Any? = null, generics: Boolean = false): Lazy<R>

Create a Lazy that retrieves a factory of type (A) -> R and applies argument to it when initialized.

lazyInstanceOrNull

fun <R : Any> WinterAware.lazyInstanceOrNull(qualifier: Any? = null, generics: Boolean = false): Lazy<R?>

Create a Lazy that retrieves an optional instance of R when initialized.

fun <A, R : Any> WinterAware.lazyInstanceOrNull(argument: A, qualifier: Any? = null, generics: Boolean = false): Lazy<R?>

Create a Lazy that retrieves an optional factory of type (A) -> R and applies argument to it when initialized.

provider

fun <R : Any> WinterAware.provider(qualifier: Any? = null, generics: Boolean = false): Provider<R>

Retrieve a non-optional provider function that returns R.

fun <A, R : Any> WinterAware.provider(argument: A, qualifier: Any? = null, generics: Boolean = false): Provider<R>

Retrieve a factory of type (A) -> R and create and return a provider that applies the given argument to the factory when called.

providerOrNull

fun <R : Any> WinterAware.providerOrNull(qualifier: Any? = null, generics: Boolean = false): Provider<R>?

Retrieve an optional provider function that returns R.

fun <A, R : Any> WinterAware.providerOrNull(argument: A, qualifier: Any? = null, generics: Boolean = false): Provider<R>?

Retrieve an optional factory of type (A) -> R and create and return a provider that applies the given argument to the factory when called.

providersOfType

fun <R : Any> WinterAware.providersOfType(generics: Boolean = false): Set<Provider<R>>

Retrieve all providers of type R.