Binding is defined in a Module
as Type -> instance relationship (sometimes
with additional identifiers).
Binding is defined in a Module
as Type -> instance relationship (sometimes
with additional identifiers).
I can be injected in classes where implicit Injector
is available.
Binding can be defined (containing a value) or undefined.
Bindings with lifecycle may have initialization and destruction handlers
Helper class to make injection with default value more readable.
Implementation to implicitly transform T
class to an Identifier
Implementation to implicitly transform T
class to an Identifier
type that should be transformed to an Identifier
Typeclass that will handle the composition of different injectors
Typeclass that will handle the composition of different injectors
type of the first injector in the composition
type of the second injector in the composition
type of the resulting injector in the composition
Same as module, but with accessible Injectable
's methods.
Trait for injectors that are freezable i.e.
Trait for injectors that are freezable i.e. may no longer be modified from e certain point
Entities that extend Identifiable
can be identified using Scaldi identifiers.
Entities that extend Identifiable
can be identified using Scaldi identifiers.
They can also contain conditions.
Helper class to make injection by identifier more readable.
Helper class to make injection by identifier more readable.
type of the dependency being injected
Used to identify a binding.
Used to identify a binding.
If you have two bindings of the same type (like String
bindings), the identifiers
may be used to identify and to inject the right one
Immutable injectors that don't have any lifecycle associated with it.
The result of the composition of two or more of the immutable injectors
A very simple implementation of an injector that just delegates the binding lookup to some other injector.
A very simple implementation of an injector that just delegates the binding lookup
to some other injector. This will protect the lifecycle of the delegated injector from
any changes. It is useful in a case of a scoped binding: if you want to use the injector
in a composition, but don't want the composition's lifecycle to influence it. In that case,
before creating the composition wrap the injector into the ImmutableWrapper
.
Trait for injectors that are initializeable i.e.
Trait for injectors that are initializeable i.e. have initialization phase
type for initializeable injector
A wrapper for a default value for the injection and for its identifiers.
A wrapper for a default value for the injection and for its identifiers.
It is here to make injection constraints look like natural language.
type of the dependency being injected
default value for injected instance. It would be used if biding is not found in the Injector
.
identifiers
Custom exception for injectors
Provides injection DSL.
Provides injection DSL. You can extend it in your classes in order to use inject methods.
The only responsibility of this trait is to provide you with inject function (so it just provides nice syntax for injecting dependencies).
In order to actually find and inject dependencies, inject
method always
takes an implicit parameter of type Injector
.
Example:
Application (implicit inj: Injector) extends Injectable { protected val db = inject [Database] // database can now be used as an instance of Database class` }
A base entity that encapsulates the binding lookup mechanism
Trait for injectors that have lifecycle
Trait for injectors that have lifecycle
type for initializeable injector
Binding that is initialized on on first use and never changes afterwards.
Binding that is initialized on on first use and never changes afterwards.
function that creates and returns value that will be associated with binding
binding's identifiers (empty by default)
binding's conditions (empty by default)
binding's lifecycle (empty by default)
Module is a place where you declare your bindings.
Module is a place where you declare your bindings. It's also the most common injector that you can use in most cases. It's a mutable injector so it can have a lifecycle and it also provides nice DSL for the bindings.
Module is an Injectable instance thanks to that you can inject other dependencies in module's bindings.
Mutable injectors that have a lifecycle associated with them.
The result of the composition of two or more of the mutable injectors
Contains implicit reference to injector: the final injector composition which is used by inject.
Contains implicit reference to injector: the final injector composition which is used by inject. Injector aggregation will set it during the initialization phase
Binding that is initialized at the Injector initialization phase (normally during an application startup) and never changes afterwards.
Binding that is initialized at the Injector initialization phase (normally during an application startup) and never changes afterwards.
function that creates and returns value that will be associated with binding
binding's identifiers (empty by default)
binding's conditions (empty by default)
binding's lifecycle (empty by default)
Exactly the same as Injectable trait, but with all methods made public
Used to look for simple bindings in supplied properties (hash table)
Binding that is initialized on every injection with createFn function.
Binding that is initialized on every injection with createFn function.
function that creates and returns value that will be associated with binding
binding's identifiers (empty by default)
binding's conditions (empty by default)
binding's lifecycle (empty by default)
Binding with a raw value, not converted to any specific type (value from system properties, configuration, etc.).
Binding with a raw value, not converted to any specific type (value from system properties, configuration, etc.).
value of the binding
identifiers defining the binding
Abstract Injector
implementation that may be extended by other injectors that get values from
specific source (command line, typesafe config, properties, etc.)
Wraps a delegated Identifier
as a required or not required
Wraps a delegated Identifier
as a required or not required
delegated Identifier
true if the wrapped identifier should be required
Binding that only contains a value.
Binding that only contains a value. As it is just a fixed value, no lifecycle is needed
binding's type
binding's value
binding's identifiers (empty by default)
binding's conditions (empty by default)
if binding should be cacheable (false by default)
if binding is eager (non lazy) (false by default)
Container that transforms a list of bindings into a valid Injector
Defines an identifier from a String
Defines an identifier from a String
String
that will be the identifier
Identifier created from any Scala type
Identifier created from any Scala type
instance that will be defined as in Identifier
Injector with bindings found in supplied typesafe configuration
(Since version 0.5) BindingProvider is deprecated and will be removed soon. As an alternative you can use ImmutableWrapper
injector to define an immutability boundary in composition or create your own injector that is marked as ImmutableInjector
.
(Since version 0.5) ReflectionBinder is deprecated and will be removed soon. As an alternative you can use WordBinder
or create your own injector that is marked as ImmutableInjector
.
(Since version 0.5)
Factory for creating injector from command line arguments
Companion object of Injectable which can be just imported in contrast to Injectable trait which always need to be extended.
Companion object of Injectable which can be just imported in contrast to Injectable trait which always need to be extended. After importing it, you can use an injection DSL without extending the trait.
Example:
import scaldi.Injectable._ val database = inject [Database]
Empty injector, used for injector combination or as a filler where injector is required, but there are no bindings.
Factories to handle different type of properties' source.
Used to look up for simple bindings in system properties.
Factories to handle different type of Typesafe config's source.
Scaldi - is Scala dependency injection library. Basically Scala already have everything you need for dependency injection. But still some things can be made easier. Goal of the project is to provide more standard and easy way to make dependency injection in Scala projects consuming power of the Scala language. With Scaldi you can define your application modules in pure Scala without any annotations or XML.
For more information see: http://scaldi.org