open class Toothpick
Main class to access toothpick features. It allows to create / retrieve scopes and perform injections.
The main rule about using TP is : TP will honor all injections in the instances it creates by itself. A soon as you use new Foo, in a provider or a binding for instance, TP is not responsible for injecting Foo; developers have to manually inject the instances they create.
open static fun closeScope(name: Any): Unit
Detach a scope from its parent, this will trigger the garbage collection of this scope and it's sub-scopes if they are not referenced outside of Toothpick. |
|
open static fun inject(obj: Any, scope: Scope): Unit
Injects all dependencies (transitively) in |
|
open static fun isScopeOpen(name: Any): Boolean
Indicates whether a scope is open. |
|
open static fun openRootScope(): Scope
Returns or opens a root scope as follows:
|
|
open static fun openScope(name: Any): Scope
Opens a scope without any parent. If a scope by this open static fun openScope(name: Any, scopeConfig: ScopeConfig): Scope
Opens a scope without any parent. If a scope by this |
|
open static fun openScopes(vararg names: Any): Scope
Opens multiple scopes in a row. Opened scopes will be children of each other in left to right order (e.g. |
|
open static fun release(scope: Scope): Unit
Resets the state of a single scope. Useful for automation testing when we want to reset the scope used to install test modules. |
|
open static fun reset(): Unit
Clears all scopes. Useful for testing and not getting any leak... open static fun reset(scope: Scope): Unit
Resets the state of a single scope. Useful for automation testing when we want to reset the scope used to install test modules. |
|
open static fun setConfiguration(configuration: Configuration): Unit
Allows to pass custom configurations. |