Package toxi.util.datatypes
Class TypedProperties
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<Object,
Object>
Convenience wrapper providing typed access to Java
Properties
files.- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
getBoolean
(String id, boolean defaultState) Returns a property as boolean.byte[]
getByteArray
(String id) Shorthand wrapper forgetByteArray(String, byte[])
automatically supplying an empty byte[] as default value.byte[]
getByteArray
(String id, byte[] defaultArray) Returns a comma delimited property value as byte[] array.float
Returns a property as float.float[]
getFloatArray
(String id) Shorthand wrapper forgetFloatArray(String, float[])
automatically supplying an empty float[] array as default value.float[]
getFloatArray
(String id, float[] defaultArray) Returns a comma delimited property value as float[] array.int
Returns a hexadecimal property as integerint
Returns a property as integer.int[]
getIntArray
(String id) Shorthand wrapper for {getIntArray(String, int[])
automatically supplying an empty int[] array as default value.int[]
getIntArray
(String id, int[] defaultArray) Returns a comma delimited property value as int[] array.String[]
getStringArray
(String id) String[]
getStringArray
(String id, String[] defaultArray) boolean
Attempts to load properties from the specified (absolute) file path (In Processing use sketchPath() or dataPath() to build absolute path).Methods inherited from class java.util.Properties
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, getProperty, getProperty, hashCode, isEmpty, keys, keySet, list, list, load, load, loadFromXML, merge, propertyNames, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, save, setProperty, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values
-
Field Details
-
DELIM
- See Also:
-
-
Constructor Details
-
TypedProperties
public TypedProperties()
-
-
Method Details
-
getBoolean
Returns a property as boolean.- Parameters:
id
- property namedefaultState
-- Returns:
- prop value
-
getByteArray
Shorthand wrapper forgetByteArray(String, byte[])
automatically supplying an empty byte[] as default value.- Parameters:
id
-- Returns:
- prop values as array
-
getByteArray
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
Returns a property as float.- Parameters:
id
-defaultValue
-- Returns:
- prop value
-
getFloatArray
Shorthand wrapper forgetFloatArray(String, float[])
automatically supplying an empty float[] array as default value.- Parameters:
id
-- Returns:
- prop values as array
-
getFloatArray
Returns a comma delimited property value as float[] array.- Parameters:
id
- prop name- Returns:
- prop items as array
-
getHexInt
Returns a hexadecimal property as integer- Parameters:
id
- prop namedefaultValue
-- Returns:
- prop value
-
getInt
Returns a property as integer.- Parameters:
id
- property namedefaultValue
-- Returns:
- prop value
-
getIntArray
Shorthand wrapper for {getIntArray(String, int[])
automatically supplying an empty int[] array as default value.- Parameters:
id
-- Returns:
- prop values as array
-
getIntArray
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
-
getStringArray
-
load
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
-