trait StaticModule extends ReflectionBinder with ImmutableInjector with Injectable
- Annotations
- @deprecated
- Deprecated
(Since version 0.5)
- Alphabetic
- By Inheritance
- StaticModule
- Injectable
- Wire
- ImmutableInjector
- Injector
- ReflectionBinder
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
case class
ReflectiveBinding(fn: () ⇒ Option[Any], identifiers: List[Identifier]) extends Binding with Product with Serializable
- Definition Classes
- ReflectionBinder
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
++[I <: Injector, R <: Injector](other: I)(implicit comp: CanCompose[StaticModule.this.type, I, R]): R
Composes two injectors.
Composes two injectors. Polymorphic, needs CanCompose trait implementation available in the scope
- I
injector's type to be composed with
- R
resulting injector's type
- other
other injector to be composed with
- comp
CanCompose implementation that will handle the composition of the two injectors
- returns
composed injector, depends on CanCompose trait's implementation
- Definition Classes
- Injector
-
def
::[I <: Injector, R <: Injector](other: I)(implicit comp: CanCompose[I, StaticModule.this.type, R]): R
Composes two injectors.
Composes two injectors. Note that the operands are inverted because the method starts with ":" Polymorphic, needs CanCompose trait implementation available in the scope
- I
injector's type to be composed with
- R
resulting injector's type
- other
other injector to be composed with
- comp
CanCompose implementation that will handle the composition of the two injectors
- returns
composed injector, depends on CanCompose trait's implementation
- Definition Classes
- Injector
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
val
by: ByWord
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)
- Attributes
- protected
- Definition Classes
- Injectable
-
implicit
def
canBeIdentifiedToConstraints[T](target: T)(implicit arg0: CanBeIdentifier[T]): InjectConstraints[Nothing]
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.
- T
type that qualifies as an identifier
- target
Instance of a class that qualifies as an identifier
- returns
InjectConstraints
- Attributes
- protected
- Definition Classes
- Injectable
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
getBinding(identifiers: List[Identifier]): Option[Binding]
Single binding lookup
Single binding lookup
- identifiers
binding's identifiers
- returns
option with binding (
None
if not found)
- Definition Classes
- StaticModule → Injector
-
def
getBindings(identifiers: List[Identifier]): List[Binding]
List of bindings lookup
List of bindings lookup
- identifiers
bindings identifiers
- returns
list of found bindings
- Definition Classes
- StaticModule → Injector
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
val
identified: IdentifiedWord[Nothing]
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)
- Attributes
- protected
- Definition Classes
- Injectable
-
def
inject[T](constraints: ⇒ InjectConstraints[T])(implicit injector: Injector, tt: scala.reflect.api.JavaUniverse.TypeTag[T], nn: NotNothing[T]): T
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
- T
type of the injected dependency
- constraints
constraints helping to define what dependency of the type
T
to inject (typically an identifier, string or a default value)- injector
implicit Injector, should be defined in the scope. It's used to lookup bindings
- tt
ensures that meta-information if type
T
is available at the runtime- nn
ensures, that type
T
is not inferred asNothing
by scala compiler, since inject needs to know the actual type at the runtime- returns
instance of injected dependency
- Attributes
- protected
- Definition Classes
- Injectable
-
def
inject[T](implicit injector: Injector, tt: scala.reflect.api.JavaUniverse.TypeTag[T], nn: NotNothing[T]): T
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
- T
type of the injected dependency
- injector
implicit Injector, should be defined in the scope. It's used to lookup bindings
- tt
ensures that meta-information if type T is available at the runtime
- nn
ensures, that type T is not inferred as
Nothing
by scala compiler, since inject needs to know the actual type at the runtime- returns
instance of injected dependency
- Attributes
- protected
- Definition Classes
- Injectable
-
def
injectAll(identifiers: Identifier*)(implicit injector: Injector): List[Any]
Injects all dependencies that are defined by identifiers.
Injects all dependencies that are defined by identifiers.
- identifiers
identifiers that were defined in module for requested injections
- injector
implicit Injector, should be defined in the scope. It's used to lookup bindings
- returns
a list of injected instances defined by identifiers
- Attributes
- protected
- Definition Classes
- Injectable
-
def
injectAllOfType[T](identifiers: Identifier*)(implicit injector: Injector, tt: scala.reflect.api.JavaUniverse.TypeTag[T], nn: NotNothing[T]): List[T]
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.- T
type of the injected dependency
- identifiers
identifiers that were defined in module for requested injections
- injector
implicit Injector, should be defined in the scope. It's used to lookup bindings
- tt
ensures that meta-information if type
T
is available at the runtime- nn
ensures, that type
T
is not inferred asNothing
by scala compiler, since inject needs to know the actual type at the runtime- returns
a list of injected instances satisfying the type
T
constraint and identifiers
- Attributes
- protected
- Definition Classes
- Injectable
-
def
injectAllOfType[T](implicit injector: Injector, tt: scala.reflect.api.JavaUniverse.TypeTag[T], nn: NotNothing[T]): List[T]
Inject all dependencies of type
T
that were defined in a module.Inject all dependencies of type
T
that were defined in a module.- T
type of the injected dependency
- injector
implicit Injector, should be defined in the scope. It's used to lookup bindings
- tt
ensures that meta-information if type
T
is available at the runtime- nn
ensures, that type
T
is not inferred asNothing
by scala compiler, since inject needs to know the actual type at the runtime- returns
a list of injected instances satisfying the type
T
constraint
- Attributes
- protected
- Definition Classes
- Injectable
-
def
injectProvider[T](constraints: ⇒ InjectConstraints[T])(implicit injector: Injector, tt: scala.reflect.api.JavaUniverse.TypeTag[T], nn: NotNothing[T]): () ⇒ T
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
.- T
type of the injected dependency
- constraints
constraints helping to define what dependency of type
T
to inject (typically an identifier, string or a default value)- injector
implicit Injector, should be defined in the scope. It's used to lookup bindings
- tt
ensures that meta-information if type
T
is available at the runtime- nn
ensures, that type
T
is not inferred asNothing
by scala compiler, since inject needs to know the actual type at the runtime- returns
a new instance of injected dependency
- Attributes
- protected
- Definition Classes
- Injectable
-
def
injectProvider[T](implicit injector: Injector, tt: scala.reflect.api.JavaUniverse.TypeTag[T], nn: NotNothing[T]): () ⇒ T
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
- T
type of the injected dependency
- injector
implicit Injector, should be defined in the scope. It's used to lookup bindings
- tt
ensures that meta-information if type
T
is available at the runtime- nn
ensures, that type
T
is not inferred asNothing
by scala compiler, since inject needs to know the actual type at the runtime- returns
a new instance of injected dependency
- Attributes
- protected
- Definition Classes
- Injectable
-
def
injectWithConstructorDefault[T, C](paramName: String)(implicit injector: Injector, tt: scala.reflect.api.JavaUniverse.TypeTag[T], ct: scala.reflect.api.JavaUniverse.TypeTag[C]): T
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 typeT
.This implies, that constructor must have one constructor with parameter
paramName
which has a default value. Method is part ofinjected
macro implementation and not intended to be used outside of it.Uses reflection.
- T
type of the injected dependency
- C
class of constructor in case dependency cannot be found by
T
identifier- paramName
name of the constructor argument with a default value
- injector
implicit Injector, should be defined in the scope. It's used to lookup bindings
- tt
ensures that meta-information if type
T
is available at the runtime- ct
ensures that meta-information if type
C
is available at the runtime- returns
instance of injected dependency. If not found by, initializes one using constructor
C
- Attributes
- protected
- Definition Classes
- Injectable
-
def
injectWithDefault[T](injector: Injector, default: ⇒ T)(identifiers: List[Identifier]): T
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.
- T
type of the injected dependency
- injector
current Injector, used to lookup bindings
- default
default value to return in case injection is not found
- identifiers
identifiers that define requested injection
- returns
injection defined by identifiers or default value if injection is not found
- Attributes
- protected
- Definition Classes
- Injectable
-
macro
def
injected[T](overrides: Tuple2[String, _]*): T
- Definition Classes
- Wire
-
macro
def
injected[T](overrides: Tuple2[Symbol, _]*): T
- Definition Classes
- Wire
-
macro
def
injected[T]: T
- Definition Classes
- Wire
- implicit val injector: Injector
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
noBindingFound(identifiers: List[Identifier]): Nothing
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.
- identifiers
a list of identifiers
- Attributes
- protected
- Definition Classes
- Injectable
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
lazy val
reflectiveBindings: List[Binding]
- Definition Classes
- ReflectionBinder
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()