Class AbstractConfigurationModule
- All Implemented Interfaces:
com.google.inject.Module
- Direct Known Subclasses:
DefaultCommonConfigModule
Derive any concrete configuration module in order to override default values.
Use bind(String, Class, Object) to set values.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> voidBinds a configuration key to a value from outside.<T> voidBinds a configuration key to a value from outside.protected final voidProcesses the default configuration.protected voidImplement this method to apply some custom configuration.protected abstract voidImplement this method to settle your default configuration.Methods inherited from class com.google.inject.AbstractModule
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
-
Constructor Details
-
AbstractConfigurationModule
public AbstractConfigurationModule()
-
-
Method Details
-
bind
Binds a configuration key to a value from outside.This operation can only be performed once per key. All unpopulated keys are supposed to be filled with a default value once
configure()is called by Guice.- Type Parameters:
T- type that is required by the given key.- Parameters:
name- the configuration key.dataType- the data type bound by the key (should be defined in configuration class).value- the configuration value to set.
-
bind
Binds a configuration key to a value from outside.This operation can only be performed once per key. All unpopulated keys are supposed to be filled with a default value once
configure()is called by Guice.- Type Parameters:
T- type that is required by the given key.- Parameters:
name- the configuration key.typeLiteral- the data type bound by the key (should be defined in configuration class).value- the configuration value to set.
-
configure
protected final void configure()Processes the default configuration.This method is called by Guice to apply the configuration values.
- Overrides:
configurein classcom.google.inject.AbstractModule
-
defaultConfigure
protected abstract void defaultConfigure()Implement this method to settle your default configuration.This is only relevant to the module that provides a certain configuration!
-
customConfigure
protected void customConfigure()Implement this method to apply some custom configuration.This method is relevant to users that want to override default configuration values. Instead of overriding this function, it is also legit to bind values from outside the instance itself by using
bind(String, Class, Object). Always to that before an instance is processed by Guice!
-