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
- Alphabetic
- By Inheritance
Inherited
- InternalModule
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- Protected
Type Members
- class BindingBuilder[T] extends ScalaAnnotatedBindingBuilder[T]
Abstract Value Members
- abstract def binderAccess: B
- Attributes
- protected[this]
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def annotatedWith[A <: Annotation](implicit arg0: ClassTag[A]): Matcher[AnnotatedElement]
- Attributes
- protected[this]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def bind[T](implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): BindingBuilder[T]
- Attributes
- protected[this]
- def bindInterceptor[I <: MethodInterceptor](classMatcher: Matcher[_ >: Class[_]] = Matchers.any(), methodMatcher: Matcher[_ >: AnnotatedElement])(implicit arg0: ClassTag[I]): Unit
- Attributes
- protected[this]
- def bindScope[T <: Annotation](scope: Scope)(implicit arg0: ClassTag[T]): Unit
- Attributes
- protected[this]
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getMembersInjector[T](implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): MembersInjector[T]
- Attributes
- protected[this]
- def getProvider[T](implicit arg0: ClassTag[T]): Provider[T]
- Attributes
- protected[this]
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def requestStaticInjection[T]()(implicit arg0: ClassTag[T]): Unit
- Attributes
- protected[this]
- 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(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()