Package io.unlaunch

Interface UnlaunchDynamicConfig


public interface UnlaunchDynamicConfig
The main interface for accessing Unlaunch Key-Value configuration data in a read-only fashion
Author:
umermansoor
  • Method Summary

    Modifier and Type Method Description
    boolean containsKey​(java.lang.String key)
    Checks if the configuration contains the specified key.
    boolean getBoolean​(java.lang.String key)
    Gets a boolean associated with the given configuration key.
    boolean getBoolean​(java.lang.String key, boolean defaultValue)
    Gets a boolean associated with the given configuration key.
    double getDouble​(java.lang.String key)
    Gets a double associated with the given configuration key.
    double getDouble​(java.lang.String key, double defaultValue)
    Gets a double associated with the given configuration key.
    float getFloat​(java.lang.String key)
    Gets a float associated with the given configuration key.
    float getFloat​(java.lang.String key, float defaultValue)
    Gets a float associated with the given configuration key.
    int getInt​(java.lang.String key)
    Gets a int associated with the given configuration key.
    int getInt​(java.lang.String key, int defaultValue)
    Gets a int associated with the given configuration key.
    long getLong​(java.lang.String key)
    Gets a long associated with the given configuration key.
    long getLong​(java.lang.String key, long defaultValue)
    Gets a long associated with the given configuration key.
    java.lang.String getString​(java.lang.String key)
    Gets a string associated with the given configuration key.
    java.lang.String getString​(java.lang.String key, java.lang.String defaultValue)
    Gets a string associated with the given configuration key.
    boolean isEmpty()
    Checks if the configuration is empty.
    int size()
    Returns the number of keys stored in this configuration.
  • Method Details

    • containsKey

      boolean containsKey​(java.lang.String key)
      Checks if the configuration contains the specified key.
      Parameters:
      key - the key whose presence in this configuration is to be tested
      Returns:
      true if the configuration contains a value for this key, false otherwise
    • getBoolean

      boolean getBoolean​(java.lang.String key)
      Gets a boolean associated with the given configuration key.
      Parameters:
      key - The configuration key.
      Returns:
      The associated boolean.
      Throws:
      UnlaunchConversionException - is thrown if the key maps to an object that is not a Boolean.
    • getBoolean

      boolean getBoolean​(java.lang.String key, boolean defaultValue)
      Gets a boolean associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated boolean.
    • getDouble

      double getDouble​(java.lang.String key)
      Gets a double associated with the given configuration key.
      Parameters:
      key - The configuration key.
      Returns:
      The associated double.
      Throws:
      UnlaunchConversionException - is thrown if the key maps to an object that is not a Double
      java.lang.NullPointerException - if the specified key is null
    • getDouble

      double getDouble​(java.lang.String key, double defaultValue)
      Gets a double associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated double.
    • getFloat

      float getFloat​(java.lang.String key)
      Gets a float associated with the given configuration key.
      Parameters:
      key - The configuration key.
      Returns:
      The associated float.
      Throws:
      UnlaunchConversionException - is thrown if the key maps to an object that is not a Float.
      java.lang.NullPointerException - if the specified key is null
    • getFloat

      float getFloat​(java.lang.String key, float defaultValue)
      Gets a float associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated float.
    • getInt

      int getInt​(java.lang.String key)
      Gets a int associated with the given configuration key.
      Parameters:
      key - The configuration key.
      Returns:
      The associated int.
      Throws:
      UnlaunchConversionException - is thrown if the key maps to an object that is not a Integer.
      java.lang.NullPointerException - if the specified key is null
    • getInt

      int getInt​(java.lang.String key, int defaultValue)
      Gets a int associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated int.
    • getLong

      long getLong​(java.lang.String key)
      Gets a long associated with the given configuration key.
      Parameters:
      key - The configuration key.
      Returns:
      The associated long.
      Throws:
      UnlaunchConversionException - is thrown if the key maps to an object that is not a Long.
      java.lang.NullPointerException - if the specified key is null
    • getLong

      long getLong​(java.lang.String key, long defaultValue)
      Gets a long associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated long.
    • getString

      java.lang.String getString​(java.lang.String key)
      Gets a string associated with the given configuration key.
      Parameters:
      key - The configuration key.
      Returns:
      The associated string.
      Throws:
      UnlaunchConversionException - is thrown if the key maps to an object that is not a String.
      java.lang.NullPointerException - if the specified key is null
    • getString

      java.lang.String getString​(java.lang.String key, java.lang.String defaultValue)
      Gets a string associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated string if key is found and has valid format, default value otherwise.
    • isEmpty

      boolean isEmpty()
      Checks if the configuration is empty.
      Returns:
      true if the configuration contains no property, false otherwise.
    • size

      int size()
      Returns the number of keys stored in this configuration.
      Returns:
      the number of keys stored in this configuration