com.google.inject
Class AbstractModule
java.lang.Object
com.google.inject.AbstractModule
- All Implemented Interfaces:
- Module
public abstract class AbstractModule
- extends java.lang.Object
- implements Module
A support class for Module
s 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:
public class MyModule extends AbstractModule {
protected void configure() {
bind(Foo.class).to(FooImpl.class).in(Scopes.CONTAINER_SCOPE);
bind(BarImpl.class);
link(Bar.class).to(BarImpl.class);
bind("port").to(8080);
}
}
- Author:
- crazybob@google.com (Bob Lee)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractModule
public AbstractModule()
configure
public final void configure(ContainerBuilder builder)
- Description copied from interface:
Module
- Configures the given builder.
- Specified by:
configure
in interface Module
configure
protected abstract void configure()
- Configures a
ContainerBuilder
via the exposed methods.
put
protected void put(java.lang.String name,
Scope scope)
- See Also:
ContainerBuilder.put(String, Scope)
bind
protected <T> ContainerBuilder.BindingBuilder<T> bind(Key<T> key)
- See Also:
ContainerBuilder.bind(Key)
bind
protected <T> ContainerBuilder.BindingBuilder<T> bind(TypeLiteral<T> typeLiteral)
- See Also:
ContainerBuilder.bind(TypeLiteral)
bind
protected <T> ContainerBuilder.BindingBuilder<T> bind(java.lang.Class<T> clazz)
- See Also:
ContainerBuilder.bind(Class)
link
protected <T> ContainerBuilder.LinkedBindingBuilder<T> link(Key<T> key)
- See Also:
ContainerBuilder.link(Key)
bind
protected ContainerBuilder.ConstantBindingBuilder bind(java.lang.String name)
- See Also:
ContainerBuilder.bind(String)
bindProperties
protected void bindProperties(java.util.Map<java.lang.String,java.lang.String> properties)
- See Also:
ContainerBuilder.bindProperties(java.util.Map)
bindProperties
protected void bindProperties(java.util.Properties properties)
- See Also:
ContainerBuilder.bindProperties(java.util.Properties)
requestStaticInjection
protected void requestStaticInjection(java.lang.Class<?>... types)
- See Also:
ContainerBuilder.requestStaticInjection(Class[])
apply
protected void apply(Module module)
- See Also:
ContainerBuilder.apply(Module)