Interface Configuration

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Configuration NOT_SUPPLIED
      Represents a not supplied configuration.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default boolean asBoolean()
      Gets the value of this configuration as an boolean.
      default int asInt()
      Gets the value of this configuration as an int.
      default long asLong()
      Gets the value of this configuration as an long.
      static ConfigurationChain configuration()  
      String get()
      Gets the value of this configuration.
      boolean isSet()
      Checks if this source has some configuration set.
      default Configuration or​(Configuration defaultConfiguration)
      Returns this configuration if it's set or the given default configuration otherwise.
      default String or​(Supplier<String> supplier)  
      default boolean orElse​(boolean defaultValue)
      Returns this configuration value if it's set, otherwise returns the given defaultValue.
      default int orElse​(int defaultValue)
      Returns this configuration value if it's set, otherwise returns the given defaultValue.
      default long orElse​(long defaultValue)
      Returns this configuration value if it's set, otherwise returns the given defaultValue.
      default String orElse​(String defaultValue)
      Returns this configuration value if it's set, otherwise returns the given defaultValue.
      default String read()
      Assumes this configuration value is pointing to an external location and reads the value at that location.
      default List<String> readLines()
      Assumes this configuration value is pointing to an external location and reads the lines at that location.
    • Field Detail

      • NOT_SUPPLIED

        static final Configuration NOT_SUPPLIED
        Represents a not supplied configuration.
    • Method Detail

      • isSet

        boolean isSet()
        Checks if this source has some configuration set.
        Returns:
        true if this source holds any configuration value.
      • get

        String get()
        Gets the value of this configuration.
        Specified by:
        get in interface Supplier<String>
        Returns:
        the configuration value.
      • asInt

        default int asInt()
        Gets the value of this configuration as an int.
        Returns:
        an int value defined by this configuration.
      • asLong

        default long asLong()
        Gets the value of this configuration as an long.
        Returns:
        a long value defined by this configuration.
      • asBoolean

        default boolean asBoolean()
        Gets the value of this configuration as an boolean.
        Returns:
        a boolean value defined by this configuration.
      • read

        default String read()
        Assumes this configuration value is pointing to an external location and reads the value at that location.
        Returns:
        the value stored in the location defined by this configuration.
      • readLines

        default List<String> readLines()
        Assumes this configuration value is pointing to an external location and reads the lines at that location.
        Returns:
        the lines stored in the location defined by this configuration.
      • or

        default Configuration or​(Configuration defaultConfiguration)
        Returns this configuration if it's set or the given default configuration otherwise.
        Parameters:
        defaultConfiguration - the default configuration to return
        Returns:
        this configuration or the default one
      • orElse

        default String orElse​(String defaultValue)
        Returns this configuration value if it's set, otherwise returns the given defaultValue.
        Parameters:
        defaultValue - the default value to return
        Returns:
        this configuration value or the default value in case this configuration is not set.
      • orElse

        default int orElse​(int defaultValue)
        Returns this configuration value if it's set, otherwise returns the given defaultValue.
        Parameters:
        defaultValue - the default value to return
        Returns:
        this configuration value or the default value in case this configuration is not set.
      • orElse

        default long orElse​(long defaultValue)
        Returns this configuration value if it's set, otherwise returns the given defaultValue.
        Parameters:
        defaultValue - the default value to return
        Returns:
        this configuration value or the default value in case this configuration is not set.
      • orElse

        default boolean orElse​(boolean defaultValue)
        Returns this configuration value if it's set, otherwise returns the given defaultValue.
        Parameters:
        defaultValue - the default value to return
        Returns:
        this configuration value or the default value in case this configuration is not set.