|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.inject.AbstractModule
public abstract class AbstractModule
A support class for Modules
which reduces repetition and
results in a more readable configuration. Simply extends this class,
implement configure()
, and call the inherited methods which mirror
those found in ContainerBuilder
. For example:
import static com.google.inject.Names.named; public class MyModule extends AbstractModule { protected void configure() { bind(Foo.class).to(FooImpl.class).in(Scopes.CONTAINER); bind(BarImpl.class); link(Bar.class).to(BarImpl.class); bindConstant(named("port")).to(8080); } }
Constructor Summary | |
---|---|
AbstractModule()
|
Method Summary | ||
---|---|---|
protected
|
bind(Class<T> clazz)
|
|
protected
|
bind(Key<T> key)
|
|
protected
|
bind(TypeLiteral<T> typeLiteral)
|
|
protected ContainerBuilder.ConstantBindingBuilder |
bindConstant(Annotation annotation)
|
|
protected ContainerBuilder.ConstantBindingBuilder |
bindConstant(Class<? extends Annotation> annotationType)
|
|
protected ContainerBuilder |
builder()
Gets the builder. |
|
protected abstract void |
configure()
Configures a ContainerBuilder via the exposed methods. |
|
void |
configure(ContainerBuilder builder)
Contributes bindings and other configurations to a container builder, so that the resulting Container will include this module properly set
up. |
|
protected void |
install(Module module)
|
|
protected
|
link(Key<T> key)
|
|
protected void |
requestStaticInjection(Class<?>... types)
|
|
protected void |
scope(Class<? extends Annotation> scopeAnnotation,
Scope scope)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractModule()
Method Detail |
---|
public final void configure(ContainerBuilder builder)
Module
Container
will include this module properly set
up.
configure
in interface Module
protected abstract void configure()
ContainerBuilder
via the exposed methods.
protected ContainerBuilder builder()
protected void scope(Class<? extends Annotation> scopeAnnotation, Scope scope)
ContainerBuilder.scope(Class, Scope)
protected <T> ContainerBuilder.BindingBuilder<T> bind(Key<T> key)
ContainerBuilder.bind(Key)
protected <T> ContainerBuilder.BindingBuilder<T> bind(TypeLiteral<T> typeLiteral)
ContainerBuilder.bind(TypeLiteral)
protected <T> ContainerBuilder.BindingBuilder<T> bind(Class<T> clazz)
ContainerBuilder.bind(Class)
protected <T> ContainerBuilder.LinkedBindingBuilder<T> link(Key<T> key)
ContainerBuilder.link(Key)
protected ContainerBuilder.ConstantBindingBuilder bindConstant(Class<? extends Annotation> annotationType)
ContainerBuilder.bindConstant(Class)
protected ContainerBuilder.ConstantBindingBuilder bindConstant(Annotation annotation)
ContainerBuilder.bindConstant(java.lang.annotation.Annotation)
protected void install(Module module)
ContainerBuilder.install(Module)
protected void requestStaticInjection(Class<?>... types)
ContainerBuilder.requestStaticInjection(Class[])
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |