Class OptionReader

java.lang.Object
dk.mada.jaxrs.model.options.OptionReader

public class OptionReader extends Object
Configuration manipulation helpers.
  • Constructor Details

    • OptionReader

      public OptionReader(Properties options)
      Constructs a new instance.
      Parameters:
      options - user's options
  • Method Details

    • bool

      public boolean bool(String name)
      Read boolean property, defaulting to false if missing.
      Parameters:
      name - the name of the option.
      Returns:
      boolean-value of the option
    • bool

      public boolean bool(String name, boolean defaultValue)
      Read boolean property, with default value if missing.
      Parameters:
      name - the name of the option.
      defaultValue - the default value if the option is not specified
      Returns:
      boolean-value of the option
    • getRequired

      public String getRequired(String name, String compatibleOptionName)
      Read required option.
      Parameters:
      name - the name of the option.
      compatibleOptionName - fall-back name if primary name not found
      Returns:
      the property value
      Throws:
      IllegalArgumentException - if the property is missin
    • getOptDefault

      public Optional<String> getOptDefault(String name, String defaultValue)
      Read optional option with default value.
      Parameters:
      name - the option name
      defaultValue - the default value, if the option is not present
      Returns:
      the property value
    • getListDefault

      public List<String> getListDefault(String name, String defaultValue)
      Read comma-separated list option with default value.
      Parameters:
      name - the option name
      defaultValue - the default value, if the option is not present
      Returns:
      the property value
    • getDefault

      public String getDefault(String name, String defaultValue)
      Read optional option with default value.
      Parameters:
      name - the option name
      defaultValue - the default value, if the option is not present
      Returns:
      the property value
    • get

      public Optional<String> get(String name)
      Read optional option value.
      Parameters:
      name - the option name
      Returns:
      the trimmed property value if present