Interface Option<T>

  • Type Parameters:
    T - option type (actually not used in the implementation but showing here connection between type declaration and option value)
    All Known Implementing Classes:
    GuiceyOptions, InstallersOptions

    public interface Option<T>
    Options used for finer configuration. In contrast to dropwizard configuration file, which is user specific, options are set during development and represent developer decisions. Options must be grouped with enum (for example, see GuiceyOptions. Usage within enums does not allow using generics for option values checking, so option type set explicitly and used internally to validate option type on option value set.

    Options could be set only on application (root) level using GuiceBundle.Builder.option(Enum, Object) method, so all options are always set before bundles processing.

    Option may provide default value (useful for most cases, especially boolean options). Option may not be set to null (protected by implementation).

    Option may be accessed in bundle using GuiceyBootstrap.option(Enum) method or using Options guice bean. Installers could access options using WithOptions interface.

    Option reads and writes are tracked in order to detect useless and default value options. All tracked information is available through OptionsInfo guice bean.

    Since:
    09.08.2016
    • Method Detail

      • getType

        java.lang.Class<T> getType()
        Returns:
        option type
      • getDefaultValue

        T getDefaultValue()
        Returns:
        option default value or null