Convenience field to make the injection look more readable when used with default values for the injection.
Convenience field to make the injection look more readable when used with default values for the injection.
Example:
inject [Database] (by default defaultDb)
Implicit cast of classes that can be identifiers to an InjectConstraints
with the identified as a first element.
Implicit cast of classes that can be identifiers to an InjectConstraints
with the identified as a first element.
Often used when a list of identifiers should be passed (for example for inject(constraint)
method).
This lets us to put the identifier in a first place to make the parameters look readable.
type that qualifies as an identifier
Instance of a class that qualifies as an identifier
InjectConstraints
Single binding lookup
Single binding lookup
binding's identifiers
option with binding (None
if not found)
Binding lookup logic
Binding lookup logic
list of identifiers identifying a depencency
a binding identified by identifiers
List of bindings lookup
List of bindings lookup
bindings identifiers
list of found bindings
Bindings lookup logic
Bindings lookup logic
list of identifiers identifying depencencies
a list of bindings identified by identifiers
Convenience field to make the injection look more readable when used with identifiers.
Convenience field to make the injection look more readable when used with identifiers.
Example:
inject [Database] (identified by 'local)
Initializes bindings that are not Lazy
Initializes bindings that are not Lazy
entity that will manage the lifecycle of the eager bindings
Injects a dependency defined by a constraint.
Injects a dependency defined by a constraint.
Usually used when there are more than one injections for a defined type T
Example:
binding identifiedBy 'host to "hostName" val host = inject[String]('host) // equals to "hostName" val db = inject (by default defaultDb) // notice that type `T` is optional in inferred in this case
type of the injected dependency
constraints helping to define what dependency of the type T
to inject (typically an identifier, string or a default value)
implicit Injector, should be defined in the scope. It's used to lookup bindings
ensures that meta-information if type T
is available at the runtime
ensures, that type T
is not inferred as Nothing
by scala compiler,
since inject needs to know the actual type at the runtime
instance of injected dependency
Injects a dependency that was previously defined in a module
Injects a dependency that was previously defined in a module
Example:
val database = inject [Database] // database can now be used as an instance of Database class
type of the injected dependency
implicit Injector, should be defined in the scope. It's used to lookup bindings
ensures that meta-information if type T is available at the runtime
ensures, that type T is not inferred as Nothing
by scala compiler,
since inject needs to know the actual type at the runtime
instance of injected dependency
Injects all dependencies that are defined by identifiers.
Injects all dependencies that are defined by identifiers.
identifiers that were defined in module for requested injections
implicit Injector, should be defined in the scope. It's used to lookup bindings
a list of injected instances defined by identifiers
Inject all dependencies of type T
that were defined in a module and that are defined by supplied identifiers.
Inject all dependencies of type T
that were defined in a module and that are defined by supplied identifiers.
type of the injected dependency
identifiers that were defined in module for requested injections
implicit Injector, should be defined in the scope. It's used to lookup bindings
ensures that meta-information if type T
is available at the runtime
ensures, that type T
is not inferred as Nothing
by scala compiler,
since inject needs to know the actual type at the runtime
a list of injected instances satisfying the type T
constraint and identifiers
Inject all dependencies of type T
that were defined in a module.
Inject all dependencies of type T
that were defined in a module.
type of the injected dependency
implicit Injector, should be defined in the scope. It's used to lookup bindings
ensures that meta-information if type T
is available at the runtime
ensures, that type T
is not inferred as Nothing
by scala compiler,
since inject needs to know the actual type at the runtime
a list of injected instances satisfying the type T
constraint
Injects a dependency (defined by a constraint) that was previously defined as a provider in a module.
Injects a dependency (defined by a constraint) that was previously defined as a provider in a module.
Usually used when there are more than one provider for a defined type T
.
type of the injected dependency
constraints helping to define what dependency of type T
to inject (typically an identifier, string or a default value)
implicit Injector, should be defined in the scope. It's used to lookup bindings
ensures that meta-information if type T
is available at the runtime
ensures, that type T
is not inferred as Nothing
by scala compiler,
since inject needs to know the actual type at the runtime
a new instance of injected dependency
Injects a dependency that was previously defined as a provider in a module
Injects a dependency that was previously defined as a provider in a module
type of the injected dependency
implicit Injector, should be defined in the scope. It's used to lookup bindings
ensures that meta-information if type T
is available at the runtime
ensures, that type T
is not inferred as Nothing
by scala compiler,
since inject needs to know the actual type at the runtime
a new instance of injected dependency
Injects a dependency defined by type T
.
Injects a dependency defined by type T
. If dependency is not found, initializes it with the default
value from the constructor of type T
.
This implies, that constructor must have one constructor with parameter paramName
which has
a default value. Method is part of injected
macro implementation and not intended to be used outside of it.
Uses reflection.
type of the injected dependency
class of constructor in case dependency cannot be found by T
identifier
name of the constructor argument with a default value
implicit Injector, should be defined in the scope. It's used to lookup bindings
ensures that meta-information if type T
is available at the runtime
ensures that meta-information if type C
is available at the runtime
instance of injected dependency. If not found by, initializes one using constructor C
Setup an injection that returns default value if an injection with supplied identifiers is not found.
Setup an injection that returns default value if an injection with supplied identifiers is not found.
type of the injected dependency
current Injector, used to lookup bindings
default value to return in case injection is not found
identifiers that define requested injection
injection defined by identifiers or default value if injection is not found
Helper method for throwing a readable exception when a binding could not be found.
Helper method for throwing a readable exception when a binding could not be found.
a list of identifiers
Same as module, but with accessible
Injectable
's methods.