package planning
Ordering
- Alphabetic
Visibility
- Public
- Protected
Package Members
- package extensions
- package sequential
- package solver
Type Members
- final case class AutoSetHook[BINDING](includeOnly: InclusionPredicate, name: Option[Identifier], weak: Boolean, pos: CodePosition)(implicit evidence$1: Tag[BINDING]) extends PlanningHook with Product with Serializable
A hook that will collect all implementations with types that are
A hook that will collect all implementations with types that are
_ <: T
into a
Set[T]
set binding available for summoning.This class is not intended to be used directly, there is a convenience helper, AutoSetModule.
Usage:
val collectCloseables = AutoSetHook[AutoCloseable]("closeables") val injector = Injector(new BootstrapModuleDef { many[PlanningHook] .add(collectCloseables) })
Then, in any class created from
injector
:class App(allCloseables: Set[AutoCloseable]) { ... }
These Auto-Sets can be used (just as example) to implement custom lifecycles:
val locator = injector.produce(modules) val closeables = locator.get[Set[AutoCloseable]]("closeables") try { locator.get[App].runMain() } finally { // reverse closeables list, Auto-Sets preserve order, in the order of *initialization* // Therefore resources should closed in the *opposite order* // e.g. if C depends on B depends on A, create: A -> B -> C, close: C -> B -> A closeables.reverse.foreach(_.close()) }
- abstract class AutoSetModule extends BootstrapModuleDef
Auto-Sets collect all bindings with static types of _implementations_ that are
_ <: T
into a summonableSet[T]
Auto-Sets collect all bindings with static types of _implementations_ that are
_ <: T
into a summonableSet[T]
- See also
same concept in MacWire: https://github.com/softwaremill/macwire#multi-wiring-wireset
- trait BindingTranslator extends AnyRef
- class PlannerDefaultImpl extends Planner
- Annotations
- @nowarn()
- final class PlanningHookAggregate extends PlanningHook
- final class PlanningObserverAggregate extends PlanningObserver
- trait SubcontextHandler[+E] extends AnyRef
Value Members
- object AutoSetHook extends Serializable
- object AutoSetModule
- object BindingTranslator
- object SubcontextHandler