net.codingwell.scalaguice
Members list
Type members
Classlikes
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
.
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.
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- BindingExtensions.type
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- InjectorExtensions.type
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\]\] {}
.
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.
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- trait ScalaModuletrait ScalaPrivateModule
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- KeyExtensions.type
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]]])))
Attributes
- Graph
- Supertypes
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]])))
Attributes
- Graph
- Supertypes
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]])))
Attributes
- Graph
- Supertypes
Analog to Guice's MapBinder
Analog to Guice's MapBinder
Use ScalaMapBinder.newMapBinder to create a map binder that is scala friendly.
Attributes
- K
The key type for the bound map
- V
The value type for the bound map
- Companion:
- object
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Attributes
- Companion:
- trait
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- ScalaMapBinder.type
Attributes
- Companion:
- object
- Graph
- Supertypes
- Self type
- AbstractModule
Attributes
- Companion:
- trait
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- ScalaModule.type
Analog to Guice's Multibinder
Analog to Guice's Multibinder
Use ScalaMultibinder.newSetBinder to create a multibinder that is scala friendly.
Attributes
- Companion:
- object
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Attributes
- Companion:
- trait
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- ScalaMultibinder.type
Analog to Guice's OptionalBinder
Analog to Guice's OptionalBinder
Use ScalaOptionBinder.newOptionBinder to create an option binder that is scala friendly.
Attributes
- Companion:
- object
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Attributes
- Companion:
- trait
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- ScalaOptionBinder.type
Attributes
- Graph
- Supertypes
- Self type
- PrivateModule
Provider for a Scala Immutable Set from a Java Set.
Value members
Concrete methods
Create a com.google.inject.TypeLiteral from a type parameter. Subtypes of scala.AnyVal will be converted to their corresponding Java wrapper classes.
Create a com.google.inject.TypeLiteral from a type parameter. Subtypes of scala.AnyVal will be converted to their corresponding Java wrapper classes.
Note that any methods that call this and accept T as a parameter must also be defined as inline to preserve T's complete structure (e.g., if T could represent a parameterized type)