java.lang.Object
org.elasticsearch.injection.guice.AbstractModule
- All Implemented Interfaces:
Module
- Direct Known Subclasses:
ActionModule,ClusterModule,DiscoveryModule,GatewayModule,IndicesModule
A support class for
Modules 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> AnnotatedBindingBuilder<T> protected <T> AnnotatedBindingBuilder<T> bind(TypeLiteral<T> typeLiteral) protected Binderbinder()Gets direct access to the underlyingBinder.protected abstract voidConfigures aBindervia the exposed methods.final voidContributes bindings and other configurations for this module tobinder.
-
Constructor Details
-
AbstractModule
public AbstractModule()
-
-
Method Details
-
configure
Description copied from interface:ModuleContributes bindings and other configurations for this module tobinder.Do not invoke this method directly to install submodules. Instead use
Binder.install(Module). -
configure
protected abstract void configure()Configures aBindervia the exposed methods. -
binder
Gets direct access to the underlyingBinder. -
bind
- See Also:
-
bind
- See Also:
-