Interface IValueMap

All Superinterfaces:
Map<String,Object>
All Known Implementing Classes:
AttributeMap, CopyOnWriteValueMap, ValueMap

public interface IValueMap extends Map<String,Object>
A Map interface that holds values, parses Strings, and exposes a variety of convenience methods.
Since:
1.2.6
Author:
Johan Compagner, Doug Donohoe
  • Method Details

    • getBoolean

      Retrieves a boolean value by key.
      Parameters:
      key - the key
      Returns:
      the value
      Throws:
      StringValueConversionException
    • getDouble

      Retrieves a double value by key.
      Parameters:
      key - the key
      Returns:
      the value
      Throws:
      StringValueConversionException
    • getDouble

      double getDouble(String key, double defaultValue) throws StringValueConversionException
      Retrieves a double value by key, using a default value if not found.
      Parameters:
      key - the key
      defaultValue - value to use if no value is in this IValueMap
      Returns:
      the value
      Throws:
      StringValueConversionException
    • getDuration

      Retrieves a Duration by key.
      Parameters:
      key - the key
      Returns:
      the Duration value
      Throws:
      StringValueConversionException
    • getInt

      Retrieves an int value by key.
      Parameters:
      key - the key
      Returns:
      the value
      Throws:
      StringValueConversionException
    • getInt

      int getInt(String key, int defaultValue) throws StringValueConversionException
      Retrieves an int value by key, using a default value if not found.
      Parameters:
      key - the key
      defaultValue - value to use if no value is in this IValueMap
      Returns:
      the value
      Throws:
      StringValueConversionException
    • getLong

      Retrieves a long value by key.
      Parameters:
      key - the key
      Returns:
      the value
      Throws:
      StringValueConversionException
    • getLong

      long getLong(String key, long defaultValue) throws StringValueConversionException
      Retrieves a long value by key, using a default value if not found.
      Parameters:
      key - the key
      defaultValue - value to use if no value in this IValueMap
      Returns:
      the value
      Throws:
      StringValueConversionException
    • getString

      String getString(String key, String defaultValue)
      Retrieves a String by key, using a default value if not found.
      Parameters:
      key - the key
      defaultValue - default value to return if value is null
      Returns:
      the String
    • getString

      Retrieves a String by key.
      Parameters:
      key - the key
      Returns:
      the String
    • getCharSequence

      Retrieves a CharSequence by key.
      Parameters:
      key - the key
      Returns:
      the CharSequence
    • getStringArray

      Retrieves a String array by key. If the value was a String[] it will be returned directly. If it was a String it will be converted to a String array of length one. If it was an array of another type, a String array will be made and each element will be converted to a String.
      Parameters:
      key - the key
      Returns:
      the String array of that key
    • getStringValue

      Retrieves a StringValue object by key.
      Parameters:
      key - the key
      Returns:
      the StringValue object
    • getInstant

      Retrieves a Instant object by key.
      Parameters:
      key - the key
      Returns:
      the Instant object
      Throws:
      StringValueConversionException
    • isImmutable

      boolean isImmutable()
      Returns whether or not this IValueMap is immutable.
      Returns:
      whether or not this IValueMap is immutable
    • makeImmutable

      Makes this IValueMap immutable by changing the underlying map representation to a Collections.unmodifiableMap. After calling this method, any attempt to modify this IValueMap will result in a RuntimeException being thrown by the Collections framework.
      Returns:
      this IValueMap
    • getKey

      Provided that the hash key is a String and you need to access the value ignoring the key's case (upper- or lowercase letters), then you may use this method to get the correct writing.
      Parameters:
      key - the key
      Returns:
      the key with the correct writing
    • getAsBoolean

      Retrieves a Boolean value by key.
      Parameters:
      key - the key
      Returns:
      the value or null if value is not a valid boolean or no value is in this IValueMap
    • getAsBoolean

      boolean getAsBoolean(String key, boolean defaultValue)
      Retrieves a boolean value by key.
      Parameters:
      key - the key
      defaultValue - the default to return
      Returns:
      the value or defaultValue if value is not a valid boolean or no value is in this IValueMap
    • getAsInteger

      Retrieves an Integer value by key.
      Parameters:
      key - the key
      Returns:
      the value or null if value is not a valid integer or no value is in this IValueMap
    • getAsInteger

      int getAsInteger(String key, int defaultValue)
      Retrieves an integer value by key.
      Parameters:
      key - the key
      defaultValue - the default to return
      Returns:
      the value or defaultValue if value is not a valid integer or no value is in this IValueMap
    • getAsLong

      Retrieves a Long value by key.
      Parameters:
      key - the key
      Returns:
      the value or null if value is not a valid long or no value is in this IValueMap
    • getAsLong

      long getAsLong(String key, long defaultValue)
      Retrieves a long value by key.
      Parameters:
      key - the key
      defaultValue - the default to return
      Returns:
      the value or defaultValue if value is not a valid long or no value is in this IValueMap
    • getAsDouble

      Retrieves a Double value by key.
      Parameters:
      key - the key
      Returns:
      the value or null if value is not a valid double or no value is in this IValueMap
    • getAsDouble

      double getAsDouble(String key, double defaultValue)
      Retrieves a double value by key.
      Parameters:
      key - the key
      defaultValue - the default to return
      Returns:
      the value or defaultValue if value is not a valid double or no value is in this IValueMap
    • getAsDuration

      Retrieves a Duration value by key.
      Parameters:
      key - the key
      Returns:
      the value or null if value is not a valid Duration or no value is in this IValueMap
    • getAsDuration

      Duration getAsDuration(String key, Duration defaultValue)
      Retrieves a Duration value by key.
      Parameters:
      key - the key
      defaultValue - the default to return
      Returns:
      the value or defaultValue if value is not a valid Duration or no value is in this IValueMap
    • getAsInstant

      Retrieves a Time value by key.
      Parameters:
      key - the key
      Returns:
      the value or null if value is not a valid Time or no value is in this IValueMap
    • getAsTime

      Instant getAsTime(String key, Instant defaultValue)
      Retrieves a Time value by key.
      Parameters:
      key - the key
      defaultValue - the default to return
      Returns:
      the value or defaultValue if value is not a valid Time or no value is in this IValueMap
    • getAsEnum

      <T extends Enum<T>> T getAsEnum(String key, Class<T> eClass)
      Retrieves an Enum value by key.
      Type Parameters:
      T - type of enum
      Parameters:
      key - the key
      eClass - the enumeration class
      Returns:
      the value or null if value is not a valid value of the Enumeration or no value is in this IValueMap
    • getAsEnum

      <T extends Enum<T>> T getAsEnum(String key, T defaultValue)
      Retrieves an Enum value by key.
      Type Parameters:
      T - type of enum
      Parameters:
      key - the key
      defaultValue - the default value from the Enumeration (cannot be null)
      Returns:
      the value or defaultValue if value is not a valid value of the Enumeration or no value is in this IValueMap
    • getAsEnum

      <T extends Enum<T>> T getAsEnum(String key, Class<T> eClass, T defaultValue)
      Retrieves an Enum value by key.
      Type Parameters:
      T - type of enum
      Parameters:
      key - the key
      eClass - the enumeration class
      defaultValue - the default value from the Enumeration (may be null)
      Returns:
      the value or defaultValue if value is not a valid value of the Enumeration or no value is in this IValueMap