Class TypedProperties

All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class TypedProperties extends Properties
Convenience wrapper providing typed access to Java Properties files.
See Also:
  • Field Details

  • Constructor Details

    • TypedProperties

      public TypedProperties()
  • Method Details

    • getBoolean

      public boolean getBoolean(String id, boolean defaultState)
      Returns a property as boolean.
      Parameters:
      id - property name
      defaultState -
      Returns:
      prop value
    • getByteArray

      public byte[] getByteArray(String id)
      Shorthand wrapper for getByteArray(String, byte[]) automatically supplying an empty byte[] as default value.
      Parameters:
      id -
      Returns:
      prop values as array
    • getByteArray

      public byte[] getByteArray(String id, byte[] defaultArray)
      Returns a comma delimited property value as byte[] array. Non-byte values will be ignored.
      Parameters:
      id - prop name
      Returns:
      prop values as array
    • getFloat

      public float getFloat(String id, float defaultValue)
      Returns a property as float.
      Parameters:
      id -
      defaultValue -
      Returns:
      prop value
    • getFloatArray

      public float[] getFloatArray(String id)
      Shorthand wrapper for getFloatArray(String, float[]) automatically supplying an empty float[] array as default value.
      Parameters:
      id -
      Returns:
      prop values as array
    • getFloatArray

      public float[] getFloatArray(String id, float[] defaultArray)
      Returns a comma delimited property value as float[] array.
      Parameters:
      id - prop name
      Returns:
      prop items as array
    • getHexInt

      public int getHexInt(String id, int defaultValue)
      Returns a hexadecimal property as integer
      Parameters:
      id - prop name
      defaultValue -
      Returns:
      prop value
    • getInt

      public int getInt(String id, int defaultValue)
      Returns a property as integer.
      Parameters:
      id - property name
      defaultValue -
      Returns:
      prop value
    • getIntArray

      public int[] getIntArray(String id)
      Shorthand wrapper for {getIntArray(String, int[]) automatically supplying an empty int[] array as default value.
      Parameters:
      id -
      Returns:
      prop values as array
    • getIntArray

      public int[] getIntArray(String id, int[] defaultArray)
      Returns a comma delimited property value as int[] array. Non-integer items will be ignored.
      Parameters:
      id - prop name
      Returns:
      prop items as array
    • getStringArray

      public String[] getStringArray(String id)
    • getStringArray

      public String[] getStringArray(String id, String[] defaultArray)
    • load

      public boolean load(String path)
      Attempts to load properties from the specified (absolute) file path (In Processing use sketchPath() or dataPath() to build absolute path).
      Parameters:
      path - config file
      Returns:
      true, if successful.
    • toHashMap

      public HashMap<String,String> toHashMap()