com.escalatesoft.subcut.inject
a function that takes a mutable binding module and initializes it with whatever bindings you want. The module will be frozen after creation of the bindings, but is mutable for the time you are defining it with the DSL.
Merge this module with another.
Merge this module with another. The resulting module will include all bindings from both modules, with this module winning if there are common bindings (binding override). If you prefer symbolic operators, ~ is an alias for this.
another BindingModule to cons with this one. Any duplicates will favor the bindings from this rather than other.
Abstract binding map definition
Abstract binding map definition
Inject for a given class with optional name.
Inject for a given class with optional name. Whatever is bound to the class will be provided. If the name is given, only a matching class/name pair will be used, and it will not fall back to just providing an implementation based only on the class.
an optional name to use for the binding match
the instance the binding was configured to return
Retrieve an optional binding for class T with the given BindingKey, if no binding is available for the binding key, a None will be returned, otherwise the binding will be evaluated and an instance of a subclass of T will be returned.
Retrieve an optional binding for class T with the given BindingKey, if no binding is available for the binding key, a None will be returned, otherwise the binding will be evaluated and an instance of a subclass of T will be returned.
a BindingKey to use for the lookup
Option[T] containing either an instance subtype of T, or None if no matching binding is found.
Retrieve an optional binding for class T with the optional name provided.
Retrieve an optional binding for class T with the optional name provided. If no binding is available with the given class and optional name, a None will be returned, otherwise the binding will be evaluated and an instance of a subclass of T will be returned.
Option[String] name, if present will be matched, if None only class will be used for lookup (note, this also means any named bindings of the same type will not be matched)
Option[T] containing either an instance subtype of T, or None if no matching binding is found.
A convenient way to obtain a string representation of the current bindings in this module.
A convenient way to obtain a string representation of the current bindings in this module. Useful for debugging.
Provide a mutable copy of these bindings to a passed in function so that it can override the bindings for just the scope of that function.
Provide a mutable copy of these bindings to a passed in function so that it can override the bindings for just the scope of that function. Useful for testing.
a function that takes the new mutable binding copy and may use it within scope. Can return any type, and the any return from the function will be returned from this function.
the value returned from the provided function.
Merge this module with another.
Merge this module with another. The resulting module will include all bindings from both modules, with this module winning if there are common bindings (binding override). If you prefer non-symbolic methods, "andThen" is an alias for this.
another BindingModule to cons with this one. Any duplicates will favor the bindings from this rather than other.
A class to create a new, immutable, binding module. In order to work, the constructor of this class takes a function to evaluate, and passes this on to a bindings method which can be used to resolve the bindingModule using the function on demand. The binding module loaned to the passed in function is mutable, allowing the convenient DSL to be used, then the bindings are copied to an immutable class upon exit of the bindings evaluation.
To use this class: