Trait

scaldi

Module

Related Doc: package scaldi

Permalink

trait Module extends WordBinder with InjectorWithLifecycle[Module] with Injectable with MutableInjectorUser with ShutdownHookLifecycleManager

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.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Module
  2. ShutdownHookLifecycleManager
  3. LifecycleManager
  4. MutableInjectorUser
  5. Injectable
  6. Wire
  7. InjectorWithLifecycle
  8. MutableInjector
  9. Initializeable
  10. Freezable
  11. Injector
  12. WordBinder
  13. AnyRef
  14. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def ++[I <: Injector, R <: Injector](other: I)(implicit comp: CanCompose[Module.this.type, I, R]): R

    Permalink
    Definition Classes
    Injector
  4. def ::[I <: Injector, R <: Injector](other: I)(implicit comp: CanCompose[I, Module.this.type, R]): R

    Permalink
    Definition Classes
    Injector
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. val IgnoringErrorHandler: (Throwable) ⇒ Boolean

    Permalink
    Definition Classes
    LifecycleManager
  7. def addDestroyable(fn: () ⇒ Unit): Unit

    Permalink
  8. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  9. def bind[T](implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): BindHelper[T]

    Permalink
    Definition Classes
    WordBinder
  10. def binding: BindHelper[Any]

    Permalink
    Definition Classes
    WordBinder
  11. val by: ByWord

    Permalink

    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
  12. implicit def canBeIdentifiedToConstraints[T](target: T)(implicit arg0: CanBeIdentifier[T]): InjectConstraints[Nothing]

    Permalink

    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
  13. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def destroy(errorHandler: (Throwable) ⇒ Boolean = IgnoringErrorHandler): Unit

    Permalink
  15. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  17. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. final def getBinding(identifiers: List[Identifier]): Option[Binding]

    Permalink

    Single binding lookup

    Single binding lookup

    identifiers

    binding's identifiers

    returns

    option with binding (None if not found)

    Definition Classes
    InjectorWithLifecycleInjector
  19. def getBindingInternal(identifiers: List[Identifier]): Option[BindingWithLifecycle]

    Permalink

    Binding lookup logic

    Binding lookup logic

    identifiers

    list of identifiers identifying a depencency

    returns

    a binding identified by identifiers

    Definition Classes
    ModuleInjectorWithLifecycle
  20. final def getBindings(identifiers: List[Identifier]): List[Binding]

    Permalink

    List of bindings lookup

    List of bindings lookup

    identifiers

    bindings identifiers

    returns

    list of found bindings

    Definition Classes
    InjectorWithLifecycleInjector
  21. def getBindingsInternal(identifiers: List[Identifier]): List[BindingWithLifecycle]

    Permalink

    Bindings lookup logic

    Bindings lookup logic

    identifiers

    list of identifiers identifying depencencies

    returns

    a list of bindings identified by identifiers

    Definition Classes
    ModuleInjectorWithLifecycle
  22. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  23. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  24. val identified: IdentifiedWord[Nothing]

    Permalink

    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
  25. def init(lifecycleManager: LifecycleManager): () ⇒ Unit

    Permalink

    Initializes bindings that are not Lazy

    Initializes bindings that are not Lazy

    lifecycleManager

    entity that will manage the lifecycle of the eager bindings

    Attributes
    protected
    Definition Classes
    ModuleInitializeable
  26. def initEagerWordBindings(lifecycleManager: LifecycleManager): () ⇒ Unit

    Permalink
    Attributes
    protected
    Definition Classes
    WordBinder
  27. def initNonLazy(): Module

    Permalink
    Definition Classes
    Initializeable
  28. def inject[T](constraints: ⇒ InjectConstraints[T])(implicit injector: Injector, tt: scala.reflect.api.JavaUniverse.TypeTag[T], nn: NotNothing[T]): T

    Permalink

    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 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
  29. def inject[T](implicit injector: Injector, tt: scala.reflect.api.JavaUniverse.TypeTag[T], nn: NotNothing[T]): T

    Permalink

    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
  30. def injectAll(identifiers: Identifier*)(implicit injector: Injector): List[Any]

    Permalink

    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
  31. def injectAllOfType[T](identifiers: Identifier*)(implicit injector: Injector, tt: scala.reflect.api.JavaUniverse.TypeTag[T], nn: NotNothing[T]): List[T]

    Permalink

    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 as Nothing 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
  32. def injectAllOfType[T](implicit injector: Injector, tt: scala.reflect.api.JavaUniverse.TypeTag[T], nn: NotNothing[T]): List[T]

    Permalink

    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 as Nothing 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
  33. def injectProvider[T](constraints: ⇒ InjectConstraints[T])(implicit injector: Injector, tt: scala.reflect.api.JavaUniverse.TypeTag[T], nn: NotNothing[T]): () ⇒ T

    Permalink

    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 as Nothing 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
  34. def injectProvider[T](implicit injector: Injector, tt: scala.reflect.api.JavaUniverse.TypeTag[T], nn: NotNothing[T]): () ⇒ T

    Permalink

    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 as Nothing 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
  35. def injectWithConstructorDefault[T, C](paramName: String)(implicit injector: Injector, tt: scala.reflect.api.JavaUniverse.TypeTag[T], ct: scala.reflect.api.JavaUniverse.TypeTag[C]): T

    Permalink

    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.

    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
  36. def injectWithDefault[T](injector: Injector, default: ⇒ T)(identifiers: List[Identifier]): T

    Permalink

    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
  37. macro def injected[T](overrides: Tuple2[String, _]*): T

    Permalink
    Definition Classes
    Wire
  38. macro def injected[T](overrides: Tuple2[Symbol, _]*): T

    Permalink
    Definition Classes
    Wire
  39. macro def injected[T]: T

    Permalink
    Definition Classes
    Wire
  40. implicit def injector: Injector

    Permalink
    Definition Classes
    MutableInjectorUser
  41. implicit val injectorFn: () ⇒ Injector

    Permalink
    Definition Classes
    MutableInjectorUser
  42. def injector_=(newParentInjector: Injector): Unit

    Permalink
    Definition Classes
    MutableInjectorUser
  43. def isFrozen: Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    InitializeableFreezable
  44. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  45. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  46. def noBindingFound(identifiers: List[Identifier]): Nothing

    Permalink

    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
  47. def notRequired(identifier: Identifier): Identifier

    Permalink
    Definition Classes
    WordBinder
  48. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  49. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  50. def partialInit(lifecycleManager: LifecycleManager): Option[() ⇒ Unit]

    Permalink
    Definition Classes
    Initializeable
  51. def required(identifier: Identifier): Identifier

    Permalink
    Definition Classes
    WordBinder
  52. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  53. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  54. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  55. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  56. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  57. def when(condition: ⇒ Condition)(fn: ⇒ Unit): Unit

    Permalink
    Definition Classes
    WordBinder
  58. lazy val wordBindings: List[BindingWithLifecycle]

    Permalink
    Definition Classes
    WordBinder

Inherited from LifecycleManager

Inherited from MutableInjectorUser

Inherited from Injectable

Inherited from Wire

Inherited from InjectorWithLifecycle[Module]

Inherited from MutableInjector

Inherited from Initializeable[Module]

Inherited from Freezable

Inherited from Injector

Inherited from WordBinder

Inherited from AnyRef

Inherited from Any

Ungrouped