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.
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.
Extensions for Guice's binding DSL. These allow using a type parameter instead of
classOf[Foo]}
ornew TypeLiteral[Bar[Foo]] {}
. The extra methods are named as those in the normal binding DSL suffixed withType
.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.