Class AbstractConfigurationModule

  • All Implemented Interfaces:
    com.google.inject.Module

    
    public abstract class AbstractConfigurationModule
    extends AbstractModule
                        

    Utility class for other modules to allow app configuration via Google Guice.

    Derive any concrete configuration module in order to override default values. Use bind to set values.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      <T> void bind(String name, Class<T> dataType, @Nullable() T value) Binds a configuration key to a value from outside.
      <T> void bind(String name, TypeLiteral<T> typeLiteral, @Nullable() T value) Binds a configuration key to a value from outside.
      • Methods inherited from class com.google.inject.AbstractModule

        configure
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractConfigurationModule

        AbstractConfigurationModule()
    • Method Detail

      • bind

         <T> void bind(String name, Class<T> dataType, @Nullable() T value)

        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.

        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

         <T> void bind(String name, TypeLiteral<T> typeLiteral, @Nullable() T value)

        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.

        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.