| java.lang.Object | |
| ↳ | com.google.inject.AbstractModule |
Known Direct Subclasses
|
Known Indirect Subclasses
|
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);
}
}
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Contributes bindings and other configurations for this module to
binder. | |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Gets direct access to the underlying
Binder. | |||||||||||
Configures a
Binder via the exposed methods. | |||||||||||
Adds a dependency from this module to
key. | |||||||||||
Adds a dependency from this module to
type. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.google.inject.Module
| |||||||||||
Contributes bindings and other configurations for this module to binder.
Do not invoke this method directly to install submodules. Instead use
install(Module), which ensures that provider methods are
discovered.
Configures a Binder via the exposed methods.
Adds a dependency from this module to 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.
Adds a dependency from this module to 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.