|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.elasticsearch.util.inject.AbstractModule
public abstract class AbstractModule
A support class for Module
s which reduces repetition and results in
a more readable configuration. Simply extend this class, implement configure()
, and call the inherited methods which mirror those found in
Binder
. For example:
public class MyModule extends AbstractModule { protected void configure() { bind(Service.class).to(ServiceImpl.class).in(Singleton.class); bind(CreditCardPaymentService.class); bind(PaymentService.class).to(CreditCardPaymentService.class); bindConstant().annotatedWith(Names.named("port")).to(8080); } }
Constructor Summary | |
---|---|
AbstractModule()
|
Method Summary | ||
---|---|---|
protected void |
addError(Message message)
|
|
protected void |
addError(java.lang.String message,
java.lang.Object... arguments)
|
|
protected void |
addError(java.lang.Throwable t)
|
|
protected
|
bind(java.lang.Class<T> clazz)
|
|
protected
|
bind(Key<T> key)
|
|
protected
|
bind(TypeLiteral<T> typeLiteral)
|
|
protected AnnotatedConstantBindingBuilder |
bindConstant()
|
|
protected Binder |
binder()
Gets direct access to the underlying Binder . |
|
protected void |
bindListener(Matcher<? super TypeLiteral<?>> typeMatcher,
TypeListener listener)
|
|
protected void |
bindScope(java.lang.Class<? extends java.lang.annotation.Annotation> scopeAnnotation,
Scope scope)
|
|
protected abstract void |
configure()
Configures a Binder via the exposed methods. |
|
void |
configure(Binder builder)
Contributes bindings and other configurations for this module to binder . |
|
protected void |
convertToTypes(Matcher<? super TypeLiteral<?>> typeMatcher,
TypeConverter converter)
|
|
protected Stage |
currentStage()
|
|
protected
|
getMembersInjector(java.lang.Class<T> type)
|
|
protected
|
getMembersInjector(TypeLiteral<T> type)
|
|
protected
|
getProvider(java.lang.Class<T> type)
|
|
protected
|
getProvider(Key<T> key)
|
|
protected void |
install(Module module)
|
|
protected void |
requestInjection(java.lang.Object instance)
|
|
protected void |
requestStaticInjection(java.lang.Class<?>... types)
|
|
protected void |
requireBinding(java.lang.Class<?> type)
Adds a dependency from this module to type . |
|
protected void |
requireBinding(Key<?> key)
Adds a dependency from this module to key . |
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(Binder builder)
Module
binder
.
Do not invoke this method directly to install submodules. Instead use
Binder.install(Module)
, which ensures that provider methods
are
discovered.
configure
in interface Module
protected abstract void configure()
Binder
via the exposed methods.
protected Binder binder()
Binder
.
protected void bindScope(java.lang.Class<? extends java.lang.annotation.Annotation> scopeAnnotation, Scope scope)
Binder.bindScope(Class, Scope)
protected <T> LinkedBindingBuilder<T> bind(Key<T> key)
Binder.bind(Key)
protected <T> AnnotatedBindingBuilder<T> bind(TypeLiteral<T> typeLiteral)
Binder.bind(TypeLiteral)
protected <T> AnnotatedBindingBuilder<T> bind(java.lang.Class<T> clazz)
Binder.bind(Class)
protected AnnotatedConstantBindingBuilder bindConstant()
Binder.bindConstant()
protected void install(Module module)
Binder.install(Module)
protected void addError(java.lang.String message, java.lang.Object... arguments)
Binder.addError(String, Object[])
protected void addError(java.lang.Throwable t)
Binder.addError(Throwable)
protected void addError(Message message)
Binder.addError(Message)
protected void requestInjection(java.lang.Object instance)
Binder.requestInjection(Object)
protected void requestStaticInjection(java.lang.Class<?>... types)
Binder.requestStaticInjection(Class[])
protected void requireBinding(Key<?> key)
key
. When the injector is
created, Guice will report an error if key
cannot be injected.
Note that this requirement may be satisfied by implicit binding, such as
a public no-arguments constructor.
protected void requireBinding(java.lang.Class<?> type)
type
. When the injector is
created, Guice will report an error if type
cannot be injected.
Note that this requirement may be satisfied by implicit binding, such as
a public no-arguments constructor.
protected <T> Provider<T> getProvider(Key<T> key)
Binder.getProvider(Key)
protected <T> Provider<T> getProvider(java.lang.Class<T> type)
Binder.getProvider(Class)
protected void convertToTypes(Matcher<? super TypeLiteral<?>> typeMatcher, TypeConverter converter)
Binder.convertToTypes(org.elasticsearch.util.inject.matcher.Matcher super org.elasticsearch.util.inject.TypeLiteral>>, org.elasticsearch.util.inject.spi.TypeConverter)
protected Stage currentStage()
Binder.currentStage()
protected <T> MembersInjector<T> getMembersInjector(java.lang.Class<T> type)
Binder.getMembersInjector(Class)
protected <T> MembersInjector<T> getMembersInjector(TypeLiteral<T> type)
Binder.getMembersInjector(TypeLiteral)
protected void bindListener(Matcher<? super TypeLiteral<?>> typeMatcher, TypeListener listener)
Binder.bindListener(org.elasticsearch.util.inject.matcher.Matcher,
org.elasticsearch.util.inject.spi.TypeListener)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |