java.lang.Object
org.elasticsearch.injection.guice.AbstractModule
- All Implemented Interfaces:
Module
- Direct Known Subclasses:
ActionModule
,ClusterModule
,DiscoveryModule
,GatewayModule
,IndicesModule
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> AnnotatedBindingBuilder
<T> protected <T> AnnotatedBindingBuilder
<T> bind
(TypeLiteral<T> typeLiteral) protected Binder
binder()
Gets direct access to the underlyingBinder
.protected abstract void
Configures aBinder
via the exposed methods.final void
Contributes bindings and other configurations for this module tobinder
.
-
Constructor Details
-
AbstractModule
public AbstractModule()
-
-
Method Details
-
configure
Description copied from interface:Module
Contributes 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 aBinder
via the exposed methods. -
binder
Gets direct access to the underlyingBinder
. -
bind
- See Also:
-
bind
- See Also:
-