Interface ValueSource

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ValueSource
A source for external option values.
Since:
1.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    A value source that will extract option values from environment variables.
    A value source that will extract option values from environment variables.
    A value source that will extract option values from system properties.
    A value source that will extract option values from system properties.
    <T> @Nullable T
    value(Option<T> option)
    Provide a value for the specified option, if any is set.
  • Method Details

    • environmentVariable

      static ValueSource environmentVariable()
      A value source that will extract option values from environment variables.

      Any of the characters :, /, and - will be replaced with _.

      Returns:
      an environment variable-backed value source with no prefix
      Since:
      1.1.0
    • environmentVariable

      static ValueSource environmentVariable(String prefix)
      A value source that will extract option values from environment variables.

      Any of the characters :, /, and - will be replaced with _.

      Parameters:
      prefix - the prefix for environment lookup, which will be prepended to keys followed by a _, or the empty string for no prefix
      Returns:
      an environment variable-backed value source
      Since:
      1.1.0
    • systemProperty

      static ValueSource systemProperty()
      A value source that will extract option values from system properties.

      Any of the characters : and / will be replaced with ..

      Returns:
      a system property-backed value source with no prefix
      Since:
      1.1.0
    • systemProperty

      static ValueSource systemProperty(String prefix)
      A value source that will extract option values from system properties.

      Any of the characters : and / will be replaced with ..

      Parameters:
      prefix - the prefix for property lookup, which will be prepended to properties followed by a ., or the empty string for no prefix
      Returns:
      a system property-backed value source
      Since:
      1.1.0
    • value

      <T> @Nullable T value(Option<T> option)
      Provide a value for the specified option, if any is set.
      Type Parameters:
      T - the value type
      Parameters:
      option - the option
      Returns:
      a value, if set
      Since:
      1.1.0