Package

net.codingwell

scalaguice

Permalink

package scalaguice

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. scalaguice
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait InternalModule[B <: Binder] extends AnyRef

    Permalink

    Allows binding via type parameters.

    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.

  2. class MapOfKToSetOfVProvider[K, V] extends ProviderWithDependencies[Map[K, Set[V]]]

    Permalink

    Provider for a Scala Immutable Map from a Java Map.

    Provider for a Scala Immutable Map from a Java Map.

    Example:

    .toProvider(new MapOfKToSetOfVProvider[K, V](Key.get(typeLiteral[JMap[K, JSet[V]]])))
  3. class MapProvider[K, V] extends ProviderWithDependencies[Map[K, V]]

    Permalink

    Provider for a Scala Immutable Map from a Java Map.

    Provider for a Scala Immutable Map from a Java Map.

    Example:

    .toProvider(new MapProvider[K, V](Key.get(typeLiteral[JMap[K, V]])))
  4. class OptionProvider[T] extends ProviderWithDependencies[Option[T]]

    Permalink

    Provider for Scala's Option from Guava's Optional.

    Provider for Scala's Option from Guava's Optional.

    Example:

    .toProvider(new OptionProvider[T](Key.get(typeLiteral[Optional[T]])))
  5. trait ScalaMapBinder[K, V] extends AnyRef

    Permalink

    Analog to Guice's MapBinder

    Analog to Guice's MapBinder

    Use ScalaMapBinder.newMapBinder to create a map binder that is scala friendly.

    K

    The key type for the bound map

    V

    The value type for the bound map

  6. trait ScalaModule extends AbstractModule with InternalModule[Binder]

    Permalink
  7. sealed trait ScalaMultibinder[T] extends AnyRef

    Permalink

    Analog to Guice's Multibinder

    Analog to Guice's Multibinder

    Use ScalaMultibinder.newSetBinder to create a multibinder that is scala friendly.

  8. trait ScalaOptionBinder[T] extends AnyRef

    Permalink

    Analog to Guice's OptionalBinder

    Analog to Guice's OptionalBinder

    Use ScalaOptionBinder.newOptionBinder to create an option binder that is scala friendly.

  9. trait ScalaPrivateModule extends PrivateModule with InternalModule[PrivateBinder]

    Permalink
  10. class SetProvider[T] extends ProviderWithDependencies[Set[T]]

    Permalink

    Provider for a Scala Immutable Set from a Java Set.

    Provider for a Scala Immutable Set from a Java Set.

    Example:

    .toProvider( new SetProvider[T]( Key.get( typeLiteral[JSet[T]] ) ) )

Value Members

  1. object BindingExtensions

    Permalink

    Extensions for Guice's binding DSL.

    Extensions for Guice's binding DSL. These allow using a type parameter instead of classOf[Foo]} or new TypeLiteral[Bar[Foo]] {}. The extra methods are named as those in the normal binding DSL suffixed with Type.

    For example, instead of

    binder.bind(new TypeLiteral[Bar[Foo]]{}).to(classOf[FooBarImpl])

    use

    import BindingExtensions._
    binder.bindType[Bar[Foo]].toType[FooImpl]

    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.

  2. object InjectorExtensions

    Permalink
  3. object KeyExtensions

    Permalink
  4. object ScalaMapBinder

    Permalink
  5. object ScalaModule

    Permalink
  6. object ScalaMultibinder

    Permalink
  7. object ScalaOptionBinder

    Permalink
  8. package binder

    Permalink
  9. def cls[T](implicit arg0: Manifest[T]): Class[T]

    Permalink
  10. def typeLiteral[T](implicit arg0: Manifest[T]): TypeLiteral[T]

    Permalink

    Create a com.google.inject.TypeLiteral from a scala.reflect.Manifest.

    Create a com.google.inject.TypeLiteral from a scala.reflect.Manifest. Subtypes of scala.AnyVal will be converted to their corresponding Java wrapper classes.

Inherited from AnyRef

Inherited from Any

Ungrouped