Interface Settings


public interface Settings
A typed container for a generic map of settings.
  • Method Details

    • getString

      @Nullable String getString(@Nonnull String key)
      Parameters:
      key - of the setting to lookup
      Returns:
      the String contained under this setting key or null
      Throws:
      ClassCastException - is the underlying setting is not a String
    • getString

      @Nonnull String getString(@Nonnull String key, @Nonnull String defaultValue)
      Parameters:
      key - of the setting to lookup
      defaultValue - the default value if the value isn't present
      Returns:
      the String contained under this setting key or the default
      Throws:
      ClassCastException - is the underlying setting is not a String
    • getBoolean

      @Nullable Boolean getBoolean(@Nonnull String key)
      Parameters:
      key - of the setting to lookup
      Returns:
      the Boolean contained under this setting key, if the String value equals "true", or null
    • getBoolean

      boolean getBoolean(@Nonnull String key, boolean defaultValue)
      Parameters:
      key - of the setting to lookup
      defaultValue - the default value if the value isn't present
      Returns:
      the boolean contained under this setting key, if the String value equals "true", or the default
    • getInt

      @Nullable Integer getInt(@Nonnull String key)
      Parameters:
      key - of the setting to lookup
      Returns:
      the Integer contained under this setting key, a parsed representation of the String, or null
      Throws:
      NumberFormatException - if the resulting string is not a legal int
    • getInt

      int getInt(@Nonnull String key, int defaultValue)
      Parameters:
      key - of the setting to lookup
      defaultValue - the default value if the value isn't present
      Returns:
      the int contained under this setting key, a parsed representation of the String, or the default
      Throws:
      NumberFormatException - if the resulting string is not a legal int
    • getLong

      @Nullable Long getLong(@Nonnull String key)
      Parameters:
      key - of the setting to lookup
      Returns:
      the Long contained under this setting key, a parsed representation of the String, or null
      Throws:
      NumberFormatException - if the resulting string is not a legal long
    • getLong

      long getLong(@Nonnull String key, long defaultValue)
      Parameters:
      key - of the setting to lookup
      defaultValue - the default value if the value isn't present
      Returns:
      the long contained under this setting key, a parsed representation of the String, or the default
      Throws:
      NumberFormatException - if the resulting string is not a legal long
    • getDouble

      @Nullable Double getDouble(@Nonnull String key)
      Parameters:
      key - of the setting to lookup
      Returns:
      the Double contained under this setting key, a parsed representation of the String, or null
      Throws:
      NumberFormatException - if the resulting string is not a legal double
    • getDouble

      double getDouble(@Nonnull String key, double defaultValue)
      Parameters:
      key - of the setting to lookup
      defaultValue - the default value if the value isn't present
      Returns:
      the double contained under this setting key, a parsed representation of the String, or the default
      Throws:
      NumberFormatException - if the resulting string is not a legal double
    • asMap

      Map<String,Object> asMap()
      Returns:
      a map representation of the settings