Trait

net.codingwell.scalaguice

InternalModule

Related Doc: package scalaguice

Permalink

trait InternalModule[B <: Binder] extends AnyRef

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])

    bindInterceptor(Matchers.any(), Matchers.annotatedWith(classOf[AOP]), new AOPI())
  }
}

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]

    bindInterceptor[AOPI](methodMatcher = annotatedWith[AOP])
  }
}

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
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. InternalModule
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class BindingBuilder[T] extends ScalaAnnotatedBindingBuilder[T]

    Permalink

Abstract Value Members

  1. abstract def binderAccess: B

    Permalink
    Attributes
    protected[this]

Concrete Value Members

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def annotatedWith[A <: Annotation](implicit arg0: Manifest[A]): Matcher[AnnotatedElement]

    Permalink
    Attributes
    protected[this]
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def bind[T](implicit arg0: Manifest[T]): BindingBuilder[T]

    Permalink
    Attributes
    protected[this]
  7. def bindInterceptor[I <: MethodInterceptor](classMatcher: Matcher[_ >: Class[_]] = Matchers.any(), methodMatcher: Matcher[_ >: AnnotatedElement])(implicit arg0: Manifest[I]): Unit

    Permalink
    Attributes
    protected[this]
  8. def bindScope[T <: Annotation](scope: Scope)(implicit arg0: Manifest[T]): Unit

    Permalink
    Attributes
    protected[this]
  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. final def eq(arg0: AnyRef): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def getMembersInjector[T](implicit arg0: Manifest[T]): MembersInjector[T]

    Permalink
    Attributes
    protected[this]
  15. def getProvider[T](implicit arg0: Manifest[T]): Provider[T]

    Permalink
    Attributes
    protected[this]
  16. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  17. final def isInstanceOf[T0]: Boolean

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

    Permalink
    Definition Classes
    AnyRef
  19. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  21. def requestStaticInjection[T]()(implicit arg0: Manifest[T]): Unit

    Permalink
    Attributes
    protected[this]
  22. final def synchronized[T0](arg0: ⇒ T0): T0

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped