net.codingwell.scalaguice

ScalaModule

trait ScalaModule extends AbstractModule

Allows binding via type parameters. Mix into AbstractModule (or subclass) to allow using a type parameter instead of classOf[Foo] or new TypeLiteral[Bar[Foo]] {}.

For example, instead of

class MyModule extends AbstractModule {
  def configure {
    bind(classOf[Service]).to(classOf[ServiceImpl]).in(classOf[Singleton])
    bind(classOf[CreditCardPaymentService])
    bind(new TypeLiteral[Bar[Foo]]{}).to(classOf[FooBarImpl])
    bind(classOf[PaymentService]).to(classOf[CreditCardPaymentService])
  }
}

use

class MyModule extends AbstractModule with ScalaModule {
  def configure {
    bind[Service].to[ServiceImpl].in[Singleton]
    bind[CreditCardPaymentService]
    bind[Bar[Foo]].to[FooBarImpl]
    bind[PaymentService].to[CreditCardPaymentService]
  }
}

Note This syntax allows binding to and from generic types. It doesn't currently allow bindings between wildcard types because the manifests for wildcard types don't provide access to type bounds.

Linear Supertypes
AbstractModule, Module, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. ScalaModule
  2. AbstractModule
  3. Module
  4. AnyRef
  5. Any
Visibility
  1. Public
  2. All

Abstract Value Members

  1. def configure (): Unit

    Attributes
    protected[inject] abstract
    Definition Classes
    AbstractModule

Concrete Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. def addError (arg0: Message): Unit

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  7. def addError (arg0: Throwable): Unit

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  8. def addError (arg0: String, arg1: <repeated...>[AnyRef]): Unit

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  9. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  10. def bind [T] (implicit arg0: Manifest[T]): ScalaAnnotatedBindingBuilder[T] { val mybinder: com.google.inject.Binder }

  11. def bind [T] (arg0: Class[T]): AnnotatedBindingBuilder[T]

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  12. def bind [T] (arg0: TypeLiteral[T]): AnnotatedBindingBuilder[T]

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  13. def bind [T] (arg0: Key[T]): LinkedBindingBuilder[T]

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  14. def bindConstant (): AnnotatedConstantBindingBuilder

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  15. def bindInterceptor (arg0: com.google.inject.matcher.Matcher[_ >: java.lang.Class[_]], arg1: com.google.inject.matcher.Matcher[_ >: java.lang.reflect.Method], arg2: <repeated...>[MethodInterceptor]): Unit

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  16. def bindListener (arg0: com.google.inject.matcher.Matcher[_ >: com.google.inject.TypeLiteral[_]], arg1: TypeListener): Unit

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  17. def bindScope (arg0: java.lang.Class[_ <: java.lang.annotation.Annotation], arg1: Scope): Unit

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  18. def binder (): Binder

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  19. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  20. def configure (arg0: Binder): Unit

    Attributes
    final
    Definition Classes
    AbstractModule → Module
  21. def convertToTypes (arg0: com.google.inject.matcher.Matcher[_ >: com.google.inject.TypeLiteral[_]], arg1: TypeConverter): Unit

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  22. def currentStage (): Stage

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  23. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  24. def equals (arg0: Any): Boolean

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

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  26. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  27. def getMembersInjector [T] (arg0: TypeLiteral[T]): MembersInjector[T]

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  28. def getMembersInjector [T] (arg0: Class[T]): MembersInjector[T]

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  29. def getProvider [T] (arg0: Class[T]): Provider[T]

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  30. def getProvider [T] (arg0: Key[T]): Provider[T]

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  31. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  32. def install (arg0: Module): Unit

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  33. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  34. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  35. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  36. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  37. def requestInjection (arg0: Any): Unit

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  38. def requestStaticInjection (arg0: <repeated...>[java.lang.Class[_]]): Unit

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  39. def requireBinding (arg0: java.lang.Class[_]): Unit

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  40. def requireBinding (arg0: com.google.inject.Key[_]): Unit

    Attributes
    protected[inject]
    Definition Classes
    AbstractModule
  41. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  42. def toString (): String

    Definition Classes
    AnyRef → Any
  43. def wait (): Unit

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from AbstractModule

Inherited from Module

Inherited from AnyRef

Inherited from Any