winter / io.jentz.winter

Package io.jentz.winter

Winter API

The building blocks of Winter are the components and the graphs.

Components

Components store the dependency provider; basically the dependency definitions provided to Winter - they are the blueprints for the graph.

Graphs

Graphs are used to retrieve and instantiate dependencies defined in components.

Think of Graphs as instances of components.

Types

BoundService

interface BoundService<R : Any>

Interface for bound service entries in a Graph.

ClassTypeKey

class ClassTypeKey<R : Any> : TypeKey<R>

Component

class Component

The Component stores the dependency providers which are than retrieved and instantiated by an instance of a graph.

GenericClassTypeKey

abstract class GenericClassTypeKey<R : Any> : TypeKey<R>

Graph

class Graph

The object graph class that retrieves and instantiates dependencies registered in its component.

Scope

data class Scope

TypeKey

interface TypeKey<out R : Any>

Interface for all type keys.

UnboundService

interface UnboundService<R : Any>

Interface for service entries registered in a Component.

Winter

object Winter : WinterApplication

The default WinterApplication object.

WinterApplication

open class WinterApplication

Holds plugins, the application Component, the application Graph and offers an abstraction to inject dependencies into classes that cannot make use of constructor injection using an InjectionAdapter system.

Exceptions

CyclicDependencyException

class CyclicDependencyException : WinterException

Exception that is thrown when a cyclic dependency was detected.

DependencyResolutionException

class DependencyResolutionException : WinterException

Exception that is thrown when an error occurs during dependency resolution.

EntryNotFoundException

class EntryNotFoundException : WinterException

Exception that is thrown when a component entry or graph was not found but was requested as non-optional.

WinterException

open class WinterException : Exception

Base exception class of all exception thrown by Winter.

Type Aliases

ComponentBuilderBlock

typealias ComponentBuilderBlock = Component.Builder.() -> Unit

Function signature alias for component builder DSL blocks.

GFactory

typealias GFactory<R> = Graph.() -> R

Factory function signature with Graph as receiver.

GFactoryCallback

typealias GFactoryCallback<R> = Graph.(R) -> Unit

Factory callback function signature with Graph as receiver. Used for onPostConstruct and onClose callbacks.

Provider

typealias Provider<R> = () -> R

Provider function signature.

Functions

component

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

Create an instance of Component.

emptyComponent

fun emptyComponent(): Component

Returns a Component without qualifier and without any declared dependencies.

emptyGraph

fun emptyGraph(): Graph

Returns a Graph with empty component.

graph

fun graph(qualifier: Any = ApplicationScope::class, block: ComponentBuilderBlock): Graph

Create an ad-hoc instance of Graph.

typeKey

fun <R : Any> typeKey(qualifier: Any? = null, generics: Boolean = false): TypeKey<R>

Returns TypeKey for type R.