org.opengts.util
Class RTProperties

java.lang.Object
  extended by org.opengts.util.RTProperties
All Implemented Interfaces:
java.lang.Cloneable, RTConfig.PropertyGetter, RTConfig.PropertySetter, StringTools.KeyValueMap

public class RTProperties
extends java.lang.Object
implements java.lang.Cloneable, StringTools.KeyValueMap, RTConfig.PropertySetter, RTConfig.PropertyGetter

Runtime properties container. Supports including other runtime property files.


Nested Class Summary
 class RTProperties.OrderedProperties
          OrderedProperties class (inner class)
 class RTProperties.PropertyChangeEvent
          PropertyChangeEvent class
static interface RTProperties.PropertyChangeListener
          PropertyChangeListener interface
 
Field Summary
static char ARRAY_DELIM
           
 boolean DEBUG
           
protected static java.lang.Class<OrderedMap> DefaultMapClass
           
static java.lang.String KEY_DFT_DELIMITER
           
static java.lang.String KEY_END_DELIMITER
           
static int KEY_MAX_RECURSION
           
static int KEY_REPLACEMENT_GLOBAL
           
static int KEY_REPLACEMENT_LOCAL
           
static int KEY_REPLACEMENT_NONE
           
static java.lang.String KEY_START_DELIMITER
           
static java.lang.String KEYVAL_PREFIX
           
static char KEYVAL_PREFIX_CHAR
           
static char KEYVAL_SEPARATOR_CHAR_1
           
static char KEYVAL_SEPARATOR_CHAR_2
           
static char[] KeyValSeparatorChars
           
static java.lang.String NameEnd
           
static java.lang.String NameStart
           
static java.lang.String PROP_removeInlineComments
           
static java.lang.String PROP_usePropertiesLoad
           
static char PropertySeparatorChar
           
 
Constructor Summary
RTProperties()
          Constructor
RTProperties(java.io.File cfgFile)
          Constructor
RTProperties(java.io.InputStream in)
          Constructor
RTProperties(java.util.Map<?,?> map)
          Constructor
RTProperties(RTProperties rtp)
          Copy Constructor
RTProperties(java.lang.String props)
          Constructor
RTProperties(java.lang.String[] argv)
          Constructor
RTProperties(java.lang.String props, boolean inclName)
          Constructor
RTProperties(java.lang.String props, char propSep)
          Constructor
RTProperties(java.lang.String props, char propSep, char[] keyValSep)
          Constructor
RTProperties(java.net.URL cfgURL)
          Constructor
 
Method Summary
 java.lang.Object _getProperty(java.lang.Object key, java.lang.Object dft)
          Gets the property value of a key
 java.lang.String _insertKeyValues(java.lang.Object key, java.lang.String text)
          Replaces references to other keys with the values of those keys
 java.lang.String _insertKeyValues(java.lang.Object mainKey, java.lang.String text, java.lang.String startDelim, java.lang.String endDelim, java.lang.String dftDelim)
          Replaces references to other keys with the values of those keys
 void addChangeListener(RTProperties.PropertyChangeListener pcl)
          Adds a PropertyChangeListener to this instance
 void checkDefaults()
          List all defined property keys which do not have a registered default value.
Used for diagnostice purposes.
 void clearProperties()
          Clears all the properties in this instance
 java.lang.Object clone()
          Returns a clone of this RTProperties instance
static boolean containsKey(java.util.Map<java.lang.Object,java.lang.Object> map, java.lang.Object key, boolean blankOK)
          Returns true if the specified property key is defined
protected static java.lang.Object convertToType(java.lang.Object val, java.lang.Class<?> type)
          Attempts to convert val to the specified class
protected static java.util.Map<java.lang.Object,java.lang.Object> CreateDefaultMap()
          Creates a default Map object container
 boolean equals(java.lang.Object other)
          Returns true if this object is equivilent to the specified object
protected  void firePropertyChanged(java.lang.Object key, java.lang.Object oldVal)
          Fires a PropertyChange event
 boolean getAllowBlankValues()
          Returns true if empty String values are allowed
 java.math.BigInteger getBigInteger(java.lang.String key)
          Gets a BigInteger property at the specified key
 java.math.BigInteger getBigInteger(java.lang.String[] key, java.math.BigInteger dft)
          Gets a BigInteger property at the specified key
 java.math.BigInteger getBigInteger(java.lang.String key, java.math.BigInteger dft)
          Gets a BigInteger property at the specified key
 java.math.BigInteger[] getBigIntegerArray(java.lang.String key, java.math.BigInteger[] dft)
          Gets a BigInteger array property at the specified key
 boolean getBoolean(java.lang.String key)
          Gets a boolean property at the specified key
 boolean getBoolean(java.lang.String[] key, boolean dft)
          Gets a boolean property at the specified key
 boolean getBoolean(java.lang.String key, boolean dft)
          Gets a boolean property at the specified key
 java.lang.Class getClass(java.lang.String key)
          Gets a Class property at the specified key
 java.lang.Class getClass(java.lang.String key, java.lang.Class dft)
          Gets a Class property at the specified key
 boolean getConfigLogMessagesEnabled()
          Returns true if configuration log messages (ie.
 double getDouble(java.lang.String key)
          Gets a double property at the specified key
 double getDouble(java.lang.String[] key, double dft)
          Gets a dobule property at the specified key
 double getDouble(java.lang.String key, double dft)
          Gets a double property at the specified key
 double[] getDoubleArray(java.lang.String key, double[] dft)
          Gets a double array property at the specified key
 java.io.File getFile(java.lang.String key)
          Gets a File property at the specified key
 java.io.File getFile(java.lang.String key, java.io.File dft)
          Gets a File property at the specified key
 java.lang.String getFirstDefinedKey(java.lang.String key)
          Returns the specified key, if defined
 java.lang.String getFirstDefinedKey(java.lang.String[] key)
          Returns the first defined property key in the list
 float getFloat(java.lang.String key)
          Gets a float property at the specified key
 float getFloat(java.lang.String[] key, float dft)
          Gets a float property at the specified key
 float getFloat(java.lang.String key, float dft)
          Gets a float property at the specified key
 float[] getFloatArray(java.lang.String key, float[] dft)
          Gets a float array property at the specified key
 boolean getIgnoreKeyCase()
          Returns true if the key case on lookups is to be ignored
protected  java.util.Map<java.lang.Object,java.lang.Object> getImmutableProperties()
          Returns a immutable wrapper around the backing properties Map for this instance.
 boolean getIncludesEnabled()
          Returns true if includes (ie.
 int getInt(java.lang.String key)
          Gets a int property at the specified key
 int getInt(java.lang.String[] key, int dft)
          Gets a int property at the specified key
 int getInt(java.lang.String key, int dft)
          Gets a int property at the specified key
 int[] getIntArray(java.lang.String[] key, int[] dft)
          Gets a int array property at the specified key
 int[] getIntArray(java.lang.String key, int[] dft)
          Gets a int array property at the specified key
 java.lang.String getKeyValue(java.lang.String key, java.lang.String arg, java.lang.String dft)
          "StringTools.KeyValueMap" interface
 char getKeyValueSeparatorChar()
          Gets the character used to seperate key/value pairs.
 char[] getKeyValueSeparatorChars()
          Gets the characters used to seperate key/value pairs.
 java.util.List<java.net.URL> getLoadedURLs()
          Gets the list of URLs loaded into this RTProperties instance
 long getLong(java.lang.String key)
          Gets a long property at the specified key
 long getLong(java.lang.String[] key, long dft)
          Gets a long property at the specified key
 long getLong(java.lang.String key, long dft)
          Gets a long property at the specified key
 long[] getLongArray(java.lang.String[] key, long[] dft)
          Gets a long array property at the specified key
 long[] getLongArray(java.lang.String key, long[] dft)
          Gets a long array property at the specified key
 java.lang.String getName()
          Gets the name of this instance.
 int getNextCommandLineArgumentIndex()
          Returns the next command-line argument following the last argument processed by the command-line argument RTProperties constructor.
 java.util.Map<java.lang.Object,java.lang.Object> getProperties()
          Gets the backing properties Map for this instance
 java.lang.Object getProperty(java.lang.Object key, java.lang.Object dft)
          Gets the property value of a key
 java.util.Set<?> getPropertyKeys()
          Gets a set of property keys defined by this RTProperties instance
 java.util.Set<java.lang.String> getPropertyKeys(java.lang.String startsWith)
          Returns a set of property keys defined in this RTProperties instance which start with the specified String
 char getPropertySeparatorChar()
          Gets the character used to seperate properties.
 java.lang.String getString(java.lang.String key)
          Gets the String value for the specified key
 java.lang.String getString(java.lang.String[] key, java.lang.String dft)
          Gets the String value for the specified key
 java.lang.String getString(java.lang.String key, java.lang.String dft)
          Gets the String value for the specified key
 java.lang.String getString(java.lang.String key, java.lang.String dft, boolean replaceKeys)
          Gets the String value for the specified key
 java.lang.String[] getStringArray(java.lang.String key)
          Gets a string array property at the specified key
 java.lang.String[] getStringArray(java.lang.String[] key, java.lang.String[] dft)
          Gets a string array property from a specified array of keys
 java.lang.String[] getStringArray(java.lang.String key, java.lang.String[] dft)
          Gets a string array property at the specified key
protected  java.util.Map<java.lang.String,java.lang.String> getStringProperties()
          Returns the backing properties Map for this instance, cast to indicate String keys and values.
 RTProperties getSubset(java.lang.String keyStartsWith)
          Returns a subset of this RTProperties instance containing key/value pairs which match the specified partial key.
 boolean hasProperty(java.lang.Object key)
          Returns true if the specified property key is defined
 boolean hasProperty(java.lang.Object[] keyList)
          Returns true if the specified property key is defined
 java.lang.String insertKeyValues(java.lang.String text)
          Replaces references to other keys with the values of those keys
 java.lang.String insertKeyValues(java.lang.String text, java.lang.String startDelim, java.lang.String endDelim)
          Replaces references to other keys with the values of those keys
 boolean isBigInteger(java.lang.String key, boolean strict)
          Returns true if the value if the specified key can be converted to a BigInteger
 boolean isBoolean(java.lang.String key, boolean strict)
          Returns true if the value if the specified key can be converted to a boolean
 boolean isDouble(java.lang.String key, boolean strict)
          Returns true if the value if the specified key can be converted to a double
 boolean isEmpty()
          Returns true if this RTProperties instance is empty (ie.
 boolean isFloat(java.lang.String key, boolean strict)
          Returns true if the value if the specified key can be converted to a float
 boolean isInt(java.lang.String key, boolean strict)
          Returns true if the value if the specified key can be converted to an int
 boolean isLong(java.lang.String key, boolean strict)
          Returns true if the value if the specified key can be converted to a long
 java.util.Iterator<?> keyIterator()
          Returns an Iterator over the property keys defined in this RTProperties instance
 void logProperties(java.lang.String msg)
          Prints the properties contained in this instance to the log output.
 void logProperties(java.lang.String msg, RTProperties exclProps, java.util.Collection<?> orderBy)
          Prints the properties contained in this instance to the log output.
static void main(java.lang.String[] argv)
          Main entry point for testing/debugging
 void printProperties(java.lang.String msg)
          Prints the properties contained in this instance to stdout.
 void printProperties(java.lang.String msg, java.util.Collection<?> orderBy)
          Prints the properties contained in this instance to stdout.
 void printProperties(java.lang.String msg, RTProperties exclProps)
          Prints the properties contained in this instance to stdout.
 void printProperties(java.lang.String msg, RTProperties exclProps, java.util.Collection<?> orderBy)
          Prints the properties contained in this instance to stdout.
 void removeChangeListener(RTProperties.PropertyChangeListener pcl)
          Removes a PropertyChangeListener from this instance
 void removeProperties(java.lang.Object key)
          Removes a property with the specified key from this instance
 void removeProperties(RTProperties rtp)
          Removes all property keys in the specified RTProperties instance from this instance
 void removeProperties(java.lang.String[] keyArry)
          Removes the specified property keys from this instance
 void removeProperty(java.lang.Object key)
          Removes a property with the specified key from this instance
 void resetProperties(java.util.Map props)
          Clears all the properties in this instance and resets them with the properties in the specified map
 void saveProperties(java.io.File cfgFile)
          Saves the properties contained in this RTProperties instance to a file
 void saveProperties(java.io.File cfgFile, boolean merge)
          Saves the properties contained in this RTProperties instance to a file
 void setAllowBlankValues(boolean allowBlank)
          Sets whether empty String values are allowed
 void setBackingProperties(java.util.Map<?,?> map)
          Sets the backing properties Map for this instance
 void setBigInteger(java.lang.String key, java.math.BigInteger value)
          Sets the value of the specified property to the specified BigInteger value
 void setBigIntegerArray(java.lang.String key, java.math.BigInteger[] value)
          Sets the value of the specified property to the specified BigInteger array value
 void setBoolean(java.lang.String key, boolean value)
          Sets the value of the specified property to the specified boolean value
 void setBooleanArray(java.lang.String key, boolean[] value)
          Sets the value of the specified property to the specified boolean array value
 void setClass(java.lang.String key, java.lang.Class value)
          Sets the value of the specified property to the specified Class
 void setConfigLogMessagesEnabled(boolean enable)
          Sets Configuration log messages (ie.
 void setDouble(java.lang.String key, double value)
          Sets the value of the specified property to the specified double value
 void setDoubleArray(java.lang.String key, double[] value)
          Sets the value of the specified property to the specified double array value
 void setFile(java.lang.String key, java.io.File value)
          Sets the value of the specified property to the specified File
 void setFloat(java.lang.String key, float value)
          Sets the value of the specified property to the specified float value
 void setFloatArray(java.lang.String key, float[] value)
          Sets the value of the specified property to the specified float array value
 void setHexInt(java.lang.String key, int value)
          Sets the property to the specified int value as a hex String value
 void setHexInt(java.lang.String key, int value, int bitLen)
          Sets the property to the specified int value as a hex String value
 void setHexLong(java.lang.String key, long value)
          Sets the property to the specified long value as a hex String
 void setHexLong(java.lang.String key, long value, int bitLen)
          Sets the property to the specified long value as a hex String
 RTProperties setIgnoreKeyCase(boolean ignCase)
          Sets whether key-case is to be ignored on propery lookups.
 void setIncludesEnabled(boolean enable)
          Sets Configuration log messages (ie.
 void setInt(java.lang.String key, int value)
          Sets the value of the property to the specified int value
 void setIntArray(java.lang.String key, int[] value)
          Sets the property to the specified int array value
 void setKeyReplacementMode(int mode)
          Sets the key replacement mode
 void setKeyValueSeparatorChar(char keyValSep)
          Sets the character used to seperate key/value pairs.
 void setKeyValueSeparatorChars(char[] keyValSep)
          Sets the characters used to seperate key/value pairs.
 void setLong(java.lang.String key, long value)
          Sets the property to the specified long value
 void setLongArray(java.lang.String key, long[] value)
          Sets the property to the specified long array value
 void setName(java.lang.String name)
          Sets the name of this instance
 java.lang.String setProperties(java.io.File file)
          Adds the properties in the saved properties in the specified file to this instance
 java.lang.String setProperties(java.io.File file, boolean inclName)
          Adds the properties in the saved properties in the specified file to this instance
 java.lang.String setProperties(java.io.InputStream in)
          Adds the properties from the specified input stream to this instance
 java.lang.String setProperties(java.io.InputStream in, boolean inclName)
          Adds the properties from the specified input stream to this instance
 java.lang.String setProperties(java.util.Map props)
          Adds the properties in the specified Map to this instance
 java.lang.String setProperties(java.util.Map props, boolean inclName)
          Adds the properties in the specified Map to this instance
 java.lang.String setProperties(RTProperties rtp)
          Adds the properties in the specified RTProperties instance to this instance
 java.lang.String setProperties(RTProperties rtp, boolean inclName)
          Adds the properties in the specified RTProperties instance to this instance
 java.lang.String setProperties(java.lang.String props)
          Adds the properties in the specified string to this instance
 java.lang.String setProperties(java.lang.String props, boolean inclName)
          Adds the properties in the specified string to this instance
 java.lang.String setProperties(java.lang.String props, char propSep)
          Adds the properties in the specified string to this instance
 java.lang.String setProperties(java.net.URL url)
          Adds the properties in the saved properties at the specified URL to this instance
 java.lang.String setProperties(java.net.URL url, boolean inclName)
          Adds the properties in the saved properties at the specified URL to this instance
 void setProperty(java.lang.Object key, java.lang.Object value)
          Sets the value for the specified key
 void setProperty(java.lang.String key, java.math.BigInteger value)
          Sets the value of the specified property to the specified BigInteger value
 void setProperty(java.lang.String key, boolean value)
          Sets the value of the specified property to the specified boolean value
 void setProperty(java.lang.String key, double value)
          Sets the value of the specified property to the specified double value
 void setProperty(java.lang.String key, float value)
          Sets the value of the specified property to the specified float value
 void setProperty(java.lang.String key, int value)
          Sets the property to the specified int value
 void setProperty(java.lang.String key, long value)
          Sets the value of the property to the specified long value
 void setProperty(java.lang.String key, java.lang.String[] val)
          Sets the value of the specified property to the specified string array
 void setPropertySeparatorChar(char propSep)
          Sets the character used to seperate properties.
static void setRemoveInlineComments(boolean ric)
          Sets removing inline comments when reading properties from an InputStream.
 void setString(java.lang.String key, java.lang.String value)
          Sets the property value for the specified key
 void setStringArray(java.lang.String key, java.lang.String[] val)
          Sets the value of the specified property to the specified string array
 void setStringArray(java.lang.String key, java.lang.String[] val, boolean alwaysQuote)
          Sets the value of the specified property to the specified string array
 int size()
          Return the number of properties in this instance
 java.lang.String toString()
          Returns a string representation of this RTProperties
 java.lang.String toString(java.util.Collection<?> orderBy)
          Returns a string representation of this RTProperties
 java.lang.String toString(RTProperties exclProps)
          Returns a string representation of this RTProperties
 java.lang.String toString(RTProperties exclProps, java.util.Collection<?> orderBy)
          Returns a string representation of this RTProperties
 java.lang.String toString(RTProperties exclProps, java.util.Collection<?> orderBy, java.lang.String newLinePrefix)
          Returns a string representation of this RTProperties
 java.lang.String[] toStringArray(boolean dashPrefix)
          Returns an array of strings representing the key/value pairs in this RTProperties
 boolean validateKeyAttributes(java.lang.String[] keyAttr, boolean printErrors)
          Validates the key/values against the expected set of keys and value types.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_usePropertiesLoad

public static final java.lang.String PROP_usePropertiesLoad
See Also:
Constant Field Values

PROP_removeInlineComments

public static final java.lang.String PROP_removeInlineComments
See Also:
Constant Field Values

NameStart

public static final java.lang.String NameStart
See Also:
Constant Field Values

NameEnd

public static final java.lang.String NameEnd
See Also:
Constant Field Values

KeyValSeparatorChars

public static final char[] KeyValSeparatorChars

PropertySeparatorChar

public static final char PropertySeparatorChar
See Also:
Constant Field Values

ARRAY_DELIM

public static final char ARRAY_DELIM
See Also:
Constant Field Values

KEY_START_DELIMITER

public static final java.lang.String KEY_START_DELIMITER
See Also:
Constant Field Values

KEY_END_DELIMITER

public static final java.lang.String KEY_END_DELIMITER
See Also:
Constant Field Values

KEY_DFT_DELIMITER

public static final java.lang.String KEY_DFT_DELIMITER
See Also:
Constant Field Values

KEY_MAX_RECURSION

public static final int KEY_MAX_RECURSION
See Also:
Constant Field Values

KEY_REPLACEMENT_NONE

public static final int KEY_REPLACEMENT_NONE
See Also:
Constant Field Values

KEY_REPLACEMENT_LOCAL

public static final int KEY_REPLACEMENT_LOCAL
See Also:
Constant Field Values

KEY_REPLACEMENT_GLOBAL

public static final int KEY_REPLACEMENT_GLOBAL
See Also:
Constant Field Values

KEYVAL_PREFIX

public static final java.lang.String KEYVAL_PREFIX
See Also:
Constant Field Values

KEYVAL_PREFIX_CHAR

public static final char KEYVAL_PREFIX_CHAR
See Also:
Constant Field Values

KEYVAL_SEPARATOR_CHAR_1

public static final char KEYVAL_SEPARATOR_CHAR_1
See Also:
Constant Field Values

KEYVAL_SEPARATOR_CHAR_2

public static final char KEYVAL_SEPARATOR_CHAR_2
See Also:
Constant Field Values

DEBUG

public boolean DEBUG

DefaultMapClass

protected static java.lang.Class<OrderedMap> DefaultMapClass
Constructor Detail

RTProperties

public RTProperties(java.util.Map<?,?> map)
Constructor

Parameters:
map - The Object key/value map used to initialize this instance

RTProperties

public RTProperties()
Constructor


RTProperties

public RTProperties(java.lang.String props)
Constructor

Parameters:
props - A String containing "key=value key=value ..." specifications used to initialize this instance.

RTProperties

public RTProperties(java.lang.String props,
                    boolean inclName)
Constructor

Parameters:
props - A String containing "key=value key=value ..." specifications used to initialize this instance.
inclName - True to parse and set the name of this instance.

RTProperties

public RTProperties(java.lang.String props,
                    char propSep)
Constructor

Parameters:
props - A String containing "key=value key=value ..." specifications used to initialize this instance.
propSep - The separator character between one "key=value" pair and the next. (ie. in "key=value;key=value", ';' is the property separator)

RTProperties

public RTProperties(java.lang.String props,
                    char propSep,
                    char[] keyValSep)
Constructor

Parameters:
props - A String containing "key=value key=value ..." specifications used to initialize this instance.
propSep - The separator character between one "key=value" pair and the next. (ie. in "key=value;key=value", ';' is the property separator)
keyValSep - The separator character between the property "key" and "value". (ie. in "key=value", ':' is the key/value separator)

RTProperties

public RTProperties(java.lang.String[] argv)
Constructor

Parameters:
argv - An array of "key=value" specifications.

RTProperties

public RTProperties(java.io.File cfgFile)
Constructor

Parameters:
cfgFile - A file specification from which the key=value properties are loaded.

RTProperties

public RTProperties(java.net.URL cfgURL)
Constructor

Parameters:
cfgURL - A URL specification from which the key=value properties are loaded.

RTProperties

public RTProperties(java.io.InputStream in)
Constructor

Parameters:
in - An InputStream from which the key=value properties are loaded.

RTProperties

public RTProperties(RTProperties rtp)
Copy Constructor

Parameters:
rtp - A RTProperties instance from this this instance is initialized
Method Detail

setRemoveInlineComments

public static void setRemoveInlineComments(boolean ric)
Sets removing inline comments when reading properties from an InputStream. Inline comments are determined by searching for the character sequence " #" on the property definition line.


clone

public java.lang.Object clone()
Returns a clone of this RTProperties instance

Overrides:
clone in class java.lang.Object
Returns:
A clone of this RTProperties instance

getLoadedURLs

public java.util.List<java.net.URL> getLoadedURLs()
Gets the list of URLs loaded into this RTProperties instance

Returns:
The list of URLs loaded into this RTProperties instance, or null if no URLs were used to load this instance.

getIgnoreKeyCase

public boolean getIgnoreKeyCase()
Returns true if the key case on lookups is to be ignored

Returns:
True if the key case on lookups is to be ignored

setIgnoreKeyCase

public RTProperties setIgnoreKeyCase(boolean ignCase)
Sets whether key-case is to be ignored on propery lookups. Only valid if the backing Map is an OrderedMap.

Parameters:
ignCase - True ignore key-case on lookups, false otherwise

getAllowBlankValues

public boolean getAllowBlankValues()
Returns true if empty String values are allowed

Returns:
True if empty String values are allowed

setAllowBlankValues

public void setAllowBlankValues(boolean allowBlank)
Sets whether empty String values are allowed

Parameters:
allowBlank - True to allow blank String values

getIncludesEnabled

public boolean getIncludesEnabled()
Returns true if includes (ie. "%include=") are enabled

Returns:
True if includes (ie. "%include=") are enabled

setIncludesEnabled

public void setIncludesEnabled(boolean enable)
Sets Configuration log messages (ie. "%log=") enabled/disabled

Parameters:
enable - True to enable, false to disable

getConfigLogMessagesEnabled

public boolean getConfigLogMessagesEnabled()
Returns true if configuration log messages (ie. "%log=") are enabled

Returns:
True if configuration log messages (ie. "%log=") are enabled

setConfigLogMessagesEnabled

public void setConfigLogMessagesEnabled(boolean enable)
Sets Configuration log messages (ie. "%log=") enabled/disabled

Parameters:
enable - True to enable, false to disable

getName

public java.lang.String getName()
Gets the name of this instance.

Returns:
The name of this instance

setName

public void setName(java.lang.String name)
Sets the name of this instance

Parameters:
name - The name of this instance to set

checkDefaults

public void checkDefaults()
List all defined property keys which do not have a registered default value.
Used for diagnostice purposes.


CreateDefaultMap

protected static java.util.Map<java.lang.Object,java.lang.Object> CreateDefaultMap()
Creates a default Map object container

Returns:
A default Map object container

getNextCommandLineArgumentIndex

public int getNextCommandLineArgumentIndex()
Returns the next command-line argument following the last argument processed by the command-line argument RTProperties constructor.

Returns:
The next command-line argument, or '-1' if there are no additional command-line arguments.

validateKeyAttributes

public boolean validateKeyAttributes(java.lang.String[] keyAttr,
                                     boolean printErrors)
Validates the key/values against the expected set of keys and value types.

Parameters:
keyAttr - A list of expected keys and attributes
Returns:
The index of the first invalid key

addChangeListener

public void addChangeListener(RTProperties.PropertyChangeListener pcl)
Adds a PropertyChangeListener to this instance

Parameters:
pcl - A PropertyChangeListener to add to this instance

removeChangeListener

public void removeChangeListener(RTProperties.PropertyChangeListener pcl)
Removes a PropertyChangeListener from this instance

Parameters:
pcl - A PropertyChangeListener to remove from this instance

firePropertyChanged

protected void firePropertyChanged(java.lang.Object key,
                                   java.lang.Object oldVal)
Fires a PropertyChange event

Parameters:
key - The property key which changed
oldVal - The old value of the property key which changed

setBackingProperties

public void setBackingProperties(java.util.Map<?,?> map)
Sets the backing properties Map for this instance

Parameters:
map - The backing properties Map to set for this instance

getProperties

public java.util.Map<java.lang.Object,java.lang.Object> getProperties()
Gets the backing properties Map for this instance

Returns:
The backing properties Map for this instance

getStringProperties

protected java.util.Map<java.lang.String,java.lang.String> getStringProperties()
Returns the backing properties Map for this instance, cast to indicate String keys and values.
WARNING: Use the Map returned by this method with caution. May cause either a ClassCastException or other Exception to be thrown if the backing Map contains any non-String keys or values.

Returns:
A Map wrapper around the backing properties Map for this instance

getImmutableProperties

protected java.util.Map<java.lang.Object,java.lang.Object> getImmutableProperties()
Returns a immutable wrapper around the backing properties Map for this instance. (not yet fully tested)

Returns:
A Map wrapper around the backing properties Map for this instance

size

public int size()
Return the number of properties in this instance

Returns:
The number of properties in this instance

isEmpty

public boolean isEmpty()
Returns true if this RTProperties instance is empty (ie. contains no properties)

Returns:
True if empty

keyIterator

public java.util.Iterator<?> keyIterator()
Returns an Iterator over the property keys defined in this RTProperties instance

Returns:
An Iterator over the property keys defined in this RTProperties instance

getPropertyKeys

public java.util.Set<?> getPropertyKeys()
Gets a set of property keys defined by this RTProperties instance

Returns:
A set of property keys defined by this RTProperties instance

getPropertyKeys

public java.util.Set<java.lang.String> getPropertyKeys(java.lang.String startsWith)
Returns a set of property keys defined in this RTProperties instance which start with the specified String

Returns:
A set of property keys defined in this RTProperties instance which start with the specified String

getSubset

public RTProperties getSubset(java.lang.String keyStartsWith)
Returns a subset of this RTProperties instance containing key/value pairs which match the specified partial key.

Parameters:
keyStartsWith - The partial key used to match keys in this instance
Returns:
The RTProperties subset

containsKey

public static boolean containsKey(java.util.Map<java.lang.Object,java.lang.Object> map,
                                  java.lang.Object key,
                                  boolean blankOK)
Returns true if the specified property key is defined

Parameters:
key - A property key
Returns:
True if the specified property key is defined

hasProperty

public boolean hasProperty(java.lang.Object[] keyList)
Returns true if the specified property key is defined

Parameters:
keyList - A list of acceptable property keys
Returns:
True if any of the specified property keys are defined

hasProperty

public boolean hasProperty(java.lang.Object key)
Returns true if the specified property key is defined

Parameters:
key - A property key
Returns:
True if the specified property key is defined

getFirstDefinedKey

public java.lang.String getFirstDefinedKey(java.lang.String[] key)
Returns the first defined property key in the list

Parameters:
key - An array of property keys
Returns:
the first defined property key in the list

getFirstDefinedKey

public java.lang.String getFirstDefinedKey(java.lang.String key)
Returns the specified key, if defined

Parameters:
key - The propery key
Returns:
The property key if defined, or null otherwise

setProperty

public void setProperty(java.lang.Object key,
                        java.lang.Object value)
Sets the value for the specified key

Specified by:
setProperty in interface RTConfig.PropertySetter
Parameters:
key - The property key
value - The value to associate with the specified key

setProperties

public java.lang.String setProperties(RTProperties rtp)
Adds the properties in the specified RTProperties instance to this instance

Parameters:
rtp - The RTProperties instance from which properties will be copied to this instance
Returns:
The name of this RTProperties instance

setProperties

public java.lang.String setProperties(RTProperties rtp,
                                      boolean inclName)
Adds the properties in the specified RTProperties instance to this instance

Parameters:
rtp - The RTProperties instance from which properties will be copied to this instance
inclName - True to set the name of this instace to the instance of the specified RTProperties instance.
Returns:
The name of this RTProperties instance

setProperties

public java.lang.String setProperties(java.net.URL url)
                               throws java.io.IOException
Adds the properties in the saved properties at the specified URL to this instance

Parameters:
url - The URL from which properties will be loaded to this instance
Returns:
The name of this RTProperties instance
Throws:
java.io.IOException - If an I/O error occurs

setProperties

public java.lang.String setProperties(java.net.URL url,
                                      boolean inclName)
                               throws java.io.IOException
Adds the properties in the saved properties at the specified URL to this instance

Parameters:
url - The URL from which properties will be loaded to this instance
inclName - True to set the name of this instace to the instance of the specified RTProperties instance.
Returns:
The name of this RTProperties instance
Throws:
java.io.IOException - If an I/O error occurs

setProperties

public java.lang.String setProperties(java.io.File file)
                               throws java.io.IOException
Adds the properties in the saved properties in the specified file to this instance

Parameters:
file - The file from which properties will be loaded to this instance
Returns:
The name of this RTProperties instance
Throws:
java.io.IOException - If an I/O error occurs

setProperties

public java.lang.String setProperties(java.io.File file,
                                      boolean inclName)
                               throws java.io.IOException
Adds the properties in the saved properties in the specified file to this instance

Parameters:
file - The file from which properties will be loaded to this instance
inclName - True to set the name of this instace to the instance of the specified RTProperties instance.
Returns:
The name of this RTProperties instance
Throws:
java.io.IOException - If an I/O error occurs

setProperties

public java.lang.String setProperties(java.io.InputStream in)
                               throws java.io.IOException
Adds the properties from the specified input stream to this instance

Parameters:
in - The input stream from which properties will be loaded to this instance
Returns:
The name of this RTProperties instance
Throws:
java.io.IOException - If an I/O error occurs

setProperties

public java.lang.String setProperties(java.io.InputStream in,
                                      boolean inclName)
                               throws java.io.IOException
Adds the properties from the specified input stream to this instance

Parameters:
in - The input stream from which properties will be loaded to this instance
inclName - True to set the name of this instace to the instance of the specified RTProperties instance.
Returns:
The name of this RTProperties instance
Throws:
java.io.IOException - If an I/O error occurs

setProperties

public java.lang.String setProperties(java.util.Map props)
Adds the properties in the specified Map to this instance

Parameters:
props - The map from which properties will be loaded to this instance
Returns:
The name of this RTProperties instance

setProperties

public java.lang.String setProperties(java.util.Map props,
                                      boolean inclName)
Adds the properties in the specified Map to this instance

Parameters:
props - The map from which properties will be loaded to this instance
inclName - True to set the name of this instace to the instance of the specified RTProperties instance.
Returns:
The name of this RTProperties instance

setPropertySeparatorChar

public void setPropertySeparatorChar(char propSep)
Sets the character used to seperate properties. Used in storing and retriving multiple properties from a string

Parameters:
propSep - The character to use to seperate properties

getPropertySeparatorChar

public char getPropertySeparatorChar()
Gets the character used to seperate properties. Used in storing and retriving multiple properties from a string

Returns:
The character to use to seperate properties

setKeyValueSeparatorChars

public void setKeyValueSeparatorChars(char[] keyValSep)
Sets the characters used to seperate key/value pairs. Used in storing and retriving multiple properties from a string

Parameters:
keyValSep - The array of key/value sperator characters

setKeyValueSeparatorChar

public void setKeyValueSeparatorChar(char keyValSep)
Sets the character used to seperate key/value pairs. Used in storing and retriving multiple properties from a string

Parameters:
keyValSep - The key/value sperator character

getKeyValueSeparatorChars

public char[] getKeyValueSeparatorChars()
Gets the characters used to seperate key/value pairs. Used in storing and retriving multiple properties from a string

Returns:
The array of key/value sperator characters

getKeyValueSeparatorChar

public char getKeyValueSeparatorChar()
Gets the character used to seperate key/value pairs. Used in storing and retriving multiple properties from a string

Returns:
The key/value sperator character

setProperties

public java.lang.String setProperties(java.lang.String props)
Adds the properties in the specified string to this instance

Parameters:
props - The string from which the properties will be added
Returns:
The name of this RTProperties instance

setProperties

public java.lang.String setProperties(java.lang.String props,
                                      char propSep)
Adds the properties in the specified string to this instance

Parameters:
props - The string from which the properties will be added
propSep - The character to set as the property seperator. Calls setPropertySeparatorChar(char), which can affect futher opperations
Returns:
The name of this RTProperties instance

setProperties

public java.lang.String setProperties(java.lang.String props,
                                      boolean inclName)
Adds the properties in the specified string to this instance

Parameters:
props - The string from which the properties will be added
inclName - True to set the name of this instace to the instance of the specified RTProperties instance
Returns:
The name of this RTProperties instance

removeProperty

public void removeProperty(java.lang.Object key)
Removes a property with the specified key from this instance

Parameters:
key - The key of the property to remove

removeProperties

public void removeProperties(java.lang.Object key)
Removes a property with the specified key from this instance

Parameters:
key - The key of the property to remove
See Also:
removeProperty(Object key)

removeProperties

public void removeProperties(java.lang.String[] keyArry)
Removes the specified property keys from this instance

Parameters:
keyArry - The array of property keys to remove

removeProperties

public void removeProperties(RTProperties rtp)
Removes all property keys in the specified RTProperties instance from this instance

Parameters:
rtp - The RTProperties instance containing the keys to remove

clearProperties

public void clearProperties()
Clears all the properties in this instance


resetProperties

public void resetProperties(java.util.Map props)
Clears all the properties in this instance and resets them with the properties in the specified map

Parameters:
props - The properties to set this instance with

insertKeyValues

public java.lang.String insertKeyValues(java.lang.String text)
Replaces references to other keys with the values of those keys

Parameters:
text - The target String
Returns:
The String containing the replaced key variables
See Also:
StringTools.insertKeyValues(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String[][])

insertKeyValues

public java.lang.String insertKeyValues(java.lang.String text,
                                        java.lang.String startDelim,
                                        java.lang.String endDelim)
Replaces references to other keys with the values of those keys

Parameters:
text - The target String
startDelim - The pattern used to determine the start of a 'key' variable
endDelim - The pattern used to determine the end of a key variable
Returns:
The String containing the replaced key variables
See Also:
StringTools.insertKeyValues(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String[][])

_insertKeyValues

public java.lang.String _insertKeyValues(java.lang.Object key,
                                         java.lang.String text)
Replaces references to other keys with the values of those keys

Parameters:
key - The main key
text - The target String
Returns:
The String containing the replaced key variables
See Also:
StringTools.insertKeyValues(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String[][])

_insertKeyValues

public java.lang.String _insertKeyValues(java.lang.Object mainKey,
                                         java.lang.String text,
                                         java.lang.String startDelim,
                                         java.lang.String endDelim,
                                         java.lang.String dftDelim)
Replaces references to other keys with the values of those keys

Parameters:
mainKey - The main key
text - The target String
startDelim - The pattern used to determine the start of a 'key' variable
endDelim - The pattern used to determine the end of a key variable
Returns:
The String containing the replaced key variables
See Also:
StringTools.insertKeyValues(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String[][])

setKeyReplacementMode

public void setKeyReplacementMode(int mode)
Sets the key replacement mode

Parameters:
mode - The key replacement mode. One of the KEY_REPLACEMENT_ constants

_getProperty

public java.lang.Object _getProperty(java.lang.Object key,
                                     java.lang.Object dft)
Gets the property value of a key

Parameters:
key - The key to get the property value of
dft - The default value to return if none found. If specified, an attempt will be made to convert the value to the class of dft (using convertToType(java.lang.Object, java.lang.Class))
Returns:
The property value of the key

getProperty

public java.lang.Object getProperty(java.lang.Object key,
                                    java.lang.Object dft)
Gets the property value of a key

Specified by:
getProperty in interface RTConfig.PropertyGetter
Parameters:
key - The key to get the property value of
dft - The default value to return if none found. If specified, an attempt will be made to convert the value to the class of dft (using convertToType(java.lang.Object, java.lang.Class))
Returns:
The property value of the key

convertToType

protected static java.lang.Object convertToType(java.lang.Object val,
                                                java.lang.Class<?> type)
                                         throws java.lang.Throwable
Attempts to convert val to the specified class

Parameters:
val - The object to attempt to convert
type - The type to attempt to convert val to
Returns:
val converted to type
Throws:
Throwble - If type conversion fails
java.lang.Throwable

getString

public java.lang.String getString(java.lang.String key)
Gets the String value for the specified key

Parameters:
key - The property key
Returns:
The String value, or null if the key is not found

getString

public java.lang.String getString(java.lang.String[] key,
                                  java.lang.String dft)
Gets the String value for the specified key

Parameters:
key - An array of property keys. The value of the first matching key will be returned.
dft - The default value return if the key is not found
Returns:
The String value, or 'dft' if the key is not found

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.String dft)
Gets the String value for the specified key

Parameters:
key - The property key.
dft - The default value return if the key is not found
Returns:
The String value, or 'dft' if the key is not found

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.String dft,
                                  boolean replaceKeys)
Gets the String value for the specified key

Parameters:
key - The property key.
dft - The default value return if the key is not found
replaceKeys - True to perform ${...} key replace, false to return raw String
Returns:
The String value, or 'dft' if the key is not found

setString

public void setString(java.lang.String key,
                      java.lang.String value)
Sets the property value for the specified key

Parameters:
key - The property key
value - The property value to set.

getKeyValue

public java.lang.String getKeyValue(java.lang.String key,
                                    java.lang.String arg,
                                    java.lang.String dft)
"StringTools.KeyValueMap" interface

Specified by:
getKeyValue in interface StringTools.KeyValueMap
Parameters:
key - The property key
arg - The property argument (not used here)
dft - The default value
Returns:
The property value

getStringArray

public java.lang.String[] getStringArray(java.lang.String key)
Gets a string array property at the specified key

Parameters:
key - The key of the property
Returns:
The string array value of the property
See Also:
StringTools.parseArray(String s, char arrayDelim)

getStringArray

public java.lang.String[] getStringArray(java.lang.String[] key,
                                         java.lang.String[] dft)
Gets a string array property from a specified array of keys

Parameters:
key - An array of property keys. The value of the first matching key will be returned.
dft - The default value to return if an entry was not found
Returns:
The string array value of the property
See Also:
StringTools.parseArray(String s, char arrayDelim)

getStringArray

public java.lang.String[] getStringArray(java.lang.String key,
                                         java.lang.String[] dft)
Gets a string array property at the specified key

Parameters:
key - The key of the property
dft - The default value to return if an entry was not found
Returns:
The string array value of the property
See Also:
StringTools.parseArray(String s, char arrayDelim)

setStringArray

public void setStringArray(java.lang.String key,
                           java.lang.String[] val)
Sets the value of the specified property to the specified string array

Parameters:
key - The key of the property
val - The value to set the property to
See Also:
StringTools.encodeArray(Object list[], char delim, boolean alwaysQuote), StringTools.parseArray(String s, char arrayDelim)

setStringArray

public void setStringArray(java.lang.String key,
                           java.lang.String[] val,
                           boolean alwaysQuote)
Sets the value of the specified property to the specified string array

Parameters:
key - The key of the property
val - The value to set the property to
alwaysQuote - True if the strings in the encoded array should always be quoted as literal values. Usually true
See Also:
StringTools.encodeArray(Object list[], char delim, boolean alwaysQuote), StringTools.parseArray(String s, char arrayDelim)

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String[] val)
Sets the value of the specified property to the specified string array

Parameters:
key - The key of the property
val - The value to set the property to
See Also:
StringTools.encodeArray(Object list[], char delim, boolean alwaysQuote), StringTools.parseArray(String s, char arrayDelim)

getClass

public java.lang.Class getClass(java.lang.String key)
Gets a Class property at the specified key

Parameters:
key - The key of the property
Returns:
The Class value of the property

getClass

public java.lang.Class getClass(java.lang.String key,
                                java.lang.Class dft)
Gets a Class property at the specified key

Parameters:
key - The key of the property
dft - The default value to return if an entry was not found
Returns:
The Class value of the property

setClass

public void setClass(java.lang.String key,
                     java.lang.Class value)
Sets the value of the specified property to the specified Class

Parameters:
key - The key of the property
value - The value to set the property to

getFile

public java.io.File getFile(java.lang.String key)
Gets a File property at the specified key

Parameters:
key - The key of the property
Returns:
The File value of the property

getFile

public java.io.File getFile(java.lang.String key,
                            java.io.File dft)
Gets a File property at the specified key

Parameters:
key - The key of the property
dft - The default value to return if an entry was not found
Returns:
The File value of the property

setFile

public void setFile(java.lang.String key,
                    java.io.File value)
Sets the value of the specified property to the specified File

Parameters:
key - The key of the property
value - The value to set the property to

isDouble

public boolean isDouble(java.lang.String key,
                        boolean strict)
Returns true if the value if the specified key can be converted to a double

Parameters:
key - The key of the property
strict - True to test for a strict double value (ie. does not contain any other superfluous trailing characters), false to allow for other non-critical trailing characters.
Returns:
True if the specified String contains a valid double value

getDouble

public double getDouble(java.lang.String key)
Gets a double property at the specified key

Parameters:
key - The key of the property
Returns:
The double value of the property

getDouble

public double getDouble(java.lang.String[] key,
                        double dft)
Gets a dobule property at the specified key

Parameters:
key - An array of property keys. The value of the first matching key will be returned.
dft - The default value to return if an entry was not found
Returns:
The double value of the property

getDouble

public double getDouble(java.lang.String key,
                        double dft)
Gets a double property at the specified key

Parameters:
key - The key of the property
dft - The default value to return if an entry was not found
Returns:
The double value of the property

getDoubleArray

public double[] getDoubleArray(java.lang.String key,
                               double[] dft)
Gets a double array property at the specified key

Parameters:
key - The key of the property
dft - The default value to return if an entry was not found
Returns:
The double array value of the property

setDouble

public void setDouble(java.lang.String key,
                      double value)
Sets the value of the specified property to the specified double value

Parameters:
key - The key of the property
value - The value to set the property to

setDoubleArray

public void setDoubleArray(java.lang.String key,
                           double[] value)
Sets the value of the specified property to the specified double array value

Parameters:
key - The key of the property
value - The value to set the property to

setProperty

public void setProperty(java.lang.String key,
                        double value)
Sets the value of the specified property to the specified double value

Parameters:
key - The key of the property
value - The value to set the property to

isFloat

public boolean isFloat(java.lang.String key,
                       boolean strict)
Returns true if the value if the specified key can be converted to a float

Parameters:
key - The key of the property
strict - True to test for a strict float value (ie. does not contain any other superfluous trailing characters), false to allow for other non-critical trailing characters.
Returns:
True if the specified String contains a valid float value

getFloat

public float getFloat(java.lang.String key)
Gets a float property at the specified key

Parameters:
key - The key of the property
Returns:
The float value of the property

getFloat

public float getFloat(java.lang.String[] key,
                      float dft)
Gets a float property at the specified key

Parameters:
key - An array of property keys. The value of the first matching key will be returned.
dft - The default value to return if an entry was not found
Returns:
The float value of the property

getFloat

public float getFloat(java.lang.String key,
                      float dft)
Gets a float property at the specified key

Parameters:
key - The key of the property
dft - The default value to return if an entry was not found
Returns:
The float value of the property

getFloatArray

public float[] getFloatArray(java.lang.String key,
                             float[] dft)
Gets a float array property at the specified key

Parameters:
key - The key of the property
dft - The default value to return if an entry was not found
Returns:
The float array value of the property

setFloat

public void setFloat(java.lang.String key,
                     float value)
Sets the value of the specified property to the specified float value

Parameters:
key - The key of the property
value - The value to set the property to

setFloatArray

public void setFloatArray(java.lang.String key,
                          float[] value)
Sets the value of the specified property to the specified float array value

Parameters:
key - The key of the property
value - The value to set the property to

setProperty

public void setProperty(java.lang.String key,
                        float value)
Sets the value of the specified property to the specified float value

Parameters:
key - The key of the property
value - The value to set the property to

isBigInteger

public boolean isBigInteger(java.lang.String key,
                            boolean strict)
Returns true if the value if the specified key can be converted to a BigInteger

Parameters:
key - The key of the property
strict - True to test for a strict BigInteger value (ie. does not contain any other superfluous trailing characters), false to allow for other non-critical trailing characters.
Returns:
True if the specified String contains a valid BigInteger value

getBigInteger

public java.math.BigInteger getBigInteger(java.lang.String key)
Gets a BigInteger property at the specified key

Parameters:
key - The key of the property
Returns:
The BigInteger value of the property

getBigInteger

public java.math.BigInteger getBigInteger(java.lang.String[] key,
                                          java.math.BigInteger dft)
Gets a BigInteger property at the specified key

Parameters:
key - An array of property keys. The value of the first matching key will be returned.
dft - The default value to return if an entry was not found
Returns:
The BigInteger value of the property

getBigInteger

public java.math.BigInteger getBigInteger(java.lang.String key,
                                          java.math.BigInteger dft)
Gets a BigInteger property at the specified key

Parameters:
key - The key of the property
dft - The default value to return if an entry was not found
Returns:
The BigInteger value of the property

getBigIntegerArray

public java.math.BigInteger[] getBigIntegerArray(java.lang.String key,
                                                 java.math.BigInteger[] dft)
Gets a BigInteger array property at the specified key

Parameters:
key - The key of the property
dft - The default value to return if an entry was not found
Returns:
The BigInteger array value of the property

setBigInteger

public void setBigInteger(java.lang.String key,
                          java.math.BigInteger value)
Sets the value of the specified property to the specified BigInteger value

Parameters:
key - The key of the property
value - The value to set the property to

setBigIntegerArray

public void setBigIntegerArray(java.lang.String key,
                               java.math.BigInteger[] value)
Sets the value of the specified property to the specified BigInteger array value

Parameters:
key - The key of the property
value - The value to set the property to

setProperty

public void setProperty(java.lang.String key,
                        java.math.BigInteger value)
Sets the value of the specified property to the specified BigInteger value

Parameters:
key - The key of the property
value - The value to set the property to

isLong

public boolean isLong(java.lang.String key,
                      boolean strict)
Returns true if the value if the specified key can be converted to a long

Parameters:
key - The key of the property
strict - True to test for a strict long value (ie. does not contain any other superfluous trailing characters), false to allow for other non-critical trailing characters.
Returns:
True if the specified String contains a valid long value

getLong

public long getLong(java.lang.String key)
Gets a long property at the specified key

Parameters:
key - The key of the property
Returns:
The long value of the property

getLong

public long getLong(java.lang.String[] key,
                    long dft)
Gets a long property at the specified key

Parameters:
key - An array of property keys. The value of the first matching key will be returned.
dft - The default value to return if an entry was not found
Returns:
The long value of the property

getLong

public long getLong(java.lang.String key,
                    long dft)
Gets a long property at the specified key

Parameters:
key - The key of the property
dft - The default value to return if an entry was not found
Returns:
The long value of the property

getLongArray

public long[] getLongArray(java.lang.String key,
                           long[] dft)
Gets a long array property at the specified key

Parameters:
key - The key of the property
dft - The default value to return if an entry was not found
Returns:
The long array value of the property

getLongArray

public long[] getLongArray(java.lang.String[] key,
                           long[] dft)
Gets a long array property at the specified key

Parameters:
key - An array of property keys. The value of the first matching key will be returned.
dft - The default value to return if an entry was not found
Returns:
The long array value of the property

setLong

public void setLong(java.lang.String key,
                    long value)
Sets the property to the specified long value

Parameters:
key - The property key
value - The value

setLongArray

public void setLongArray(java.lang.String key,
                         long[] value)
Sets the property to the specified long array value

Parameters:
key - The property key
value - The value

setProperty

public void setProperty(java.lang.String key,
                        long value)
Sets the value of the property to the specified long value

Parameters:
key - The property key
value - The value

setHexLong

public void setHexLong(java.lang.String key,
                       long value)
Sets the property to the specified long value as a hex String

Parameters:
key - The property key
value - The value

setHexLong

public void setHexLong(java.lang.String key,
                       long value,
                       int bitLen)
Sets the property to the specified long value as a hex String

Parameters:
key - The property key
value - The value
bitLen - The bit-width of the saved hex value

isInt

public boolean isInt(java.lang.String key,
                     boolean strict)
Returns true if the value if the specified key can be converted to an int

Parameters:
key - The key of the property
strict - True to test for a strict int value (ie. does not contain any other superfluous trailing characters), false to allow for other non-critical trailing characters.
Returns:
True if the specified String contains a valid int value

getInt

public int getInt(java.lang.String key)
Gets a int property at the specified key

Parameters:
key - The key of the property
Returns:
The int value of the property

getInt

public int getInt(java.lang.String[] key,
                  int dft)
Gets a int property at the specified key

Parameters:
key - An array of property keys. The value of the first matching key will be returned.
dft - The default value to return if an entry was not found
Returns:
The int value of the property

getInt

public int getInt(java.lang.String key,
                  int dft)
Gets a int property at the specified key

Parameters:
key - The key of the property
dft - The default value to return if an entry was not found
Returns:
The int value of the property

getIntArray

public int[] getIntArray(java.lang.String key,
                         int[] dft)
Gets a int array property at the specified key

Parameters:
key - The key of the property
dft - The default value to return if an entry was not found
Returns:
The int array value of the property

getIntArray

public int[] getIntArray(java.lang.String[] key,
                         int[] dft)
Gets a int array property at the specified key

Parameters:
key - An array of property keys. The value of the first matching key will be returned.
dft - The default value to return if an entry was not found
Returns:
The int value of the property

setInt

public void setInt(java.lang.String key,
                   int value)
Sets the value of the property to the specified int value

Parameters:
key - The property key
value - The value

setIntArray

public void setIntArray(java.lang.String key,
                        int[] value)
Sets the property to the specified int array value

Parameters:
key - The property key
value - The value

setProperty

public void setProperty(java.lang.String key,
                        int value)
Sets the property to the specified int value

Parameters:
key - The property key
value - The value

setHexInt

public void setHexInt(java.lang.String key,
                      int value)
Sets the property to the specified int value as a hex String value

Parameters:
key - The property key
value - The value

setHexInt

public void setHexInt(java.lang.String key,
                      int value,
                      int bitLen)
Sets the property to the specified int value as a hex String value

Parameters:
key - The property key
value - The value
bitLen - The bit-width of the saved hex value

isBoolean

public boolean isBoolean(java.lang.String key,
                         boolean strict)
Returns true if the value if the specified key can be converted to a boolean

Parameters:
key - The key of the property
strict - True to test for a strict boolean value (ie. does not contain any other superfluous trailing characters), false to allow for other non-critical trailing characters.
Returns:
True if the specified String contains a valid boolean value

getBoolean

public boolean getBoolean(java.lang.String key)
Gets a boolean property at the specified key

Parameters:
key - The key of the property
Returns:
The boolean value of the property

getBoolean

public boolean getBoolean(java.lang.String[] key,
                          boolean dft)
Gets a boolean property at the specified key

Parameters:
key - An array of property keys. The value of the first matching key will be returned.
dft - The default value to return if an entry was not found
Returns:
The boolean value of the property

getBoolean

public boolean getBoolean(java.lang.String key,
                          boolean dft)
Gets a boolean property at the specified key

Parameters:
key - The key of the property
dft - The default value to return if an entry was not found
Returns:
The boolean value of the property

setBoolean

public void setBoolean(java.lang.String key,
                       boolean value)
Sets the value of the specified property to the specified boolean value

Parameters:
key - The key of the property
value - The value to set the property to

setBooleanArray

public void setBooleanArray(java.lang.String key,
                            boolean[] value)
Sets the value of the specified property to the specified boolean array value

Parameters:
key - The key of the property
value - The value to set the property to

setProperty

public void setProperty(java.lang.String key,
                        boolean value)
Sets the value of the specified property to the specified boolean value

Parameters:
key - The key of the property
value - The value to set the property to

printProperties

public void printProperties(java.lang.String msg)
Prints the properties contained in this instance to stdout. The properties are printed as returned by toString(RTProperties, Collection, String) using Print.sysPrintln(java.lang.String, java.lang.Object...)

Parameters:
msg - The first line printed, as a header for the properties list

printProperties

public void printProperties(java.lang.String msg,
                            RTProperties exclProps)
Prints the properties contained in this instance to stdout. The properties are printed as returned by toString(RTProperties, Collection, String) using Print.sysPrintln(java.lang.String, java.lang.Object...)

Parameters:
msg - The first line printed, as a header for the properties list
exclProps - An RTProperties containing items to exclude

printProperties

public void printProperties(java.lang.String msg,
                            java.util.Collection<?> orderBy)
Prints the properties contained in this instance to stdout. The properties are printed as returned by toString(RTProperties, Collection, String) using Print.sysPrintln(java.lang.String, java.lang.Object...)

Parameters:
msg - The first line printed, as a header for the properties list
orderBy - A Collection of keys to order the properties by

printProperties

public void printProperties(java.lang.String msg,
                            RTProperties exclProps,
                            java.util.Collection<?> orderBy)
Prints the properties contained in this instance to stdout. The properties are printed as returned by toString(RTProperties, Collection, String) using Print.sysPrintln(java.lang.String, java.lang.Object...)

Parameters:
msg - The first line printed, as a header for the properties list
exclProps - An RTProperties containing items to exclude
orderBy - A Collection of keys to order the properties by

logProperties

public void logProperties(java.lang.String msg)
Prints the properties contained in this instance to the log output. The properties are printed as returned by toString(RTProperties, Collection, String) using Print.sysPrintln(java.lang.String, java.lang.Object...)

Parameters:
msg - The first line printed, as a header for the properties list

logProperties

public void logProperties(java.lang.String msg,
                          RTProperties exclProps,
                          java.util.Collection<?> orderBy)
Prints the properties contained in this instance to the log output. The properties are printed as returned by toString(RTProperties, Collection, String) using Print.sysPrintln(java.lang.String, java.lang.Object...)

Parameters:
msg - The first line printed, as a header for the properties list
exclProps - An RTProperties containing items to exclude
orderBy - A Collection of keys to order the properties by

equals

public boolean equals(java.lang.Object other)
Returns true if this object is equivilent to the specified object

Overrides:
equals in class java.lang.Object
Parameters:
other - The other object
Returns:
True if this object is equivilent to the specified object

saveProperties

public void saveProperties(java.io.File cfgFile)
                    throws java.io.IOException
Saves the properties contained in this RTProperties instance to a file

Parameters:
cfgFile - The file to which the properties are saved.
Throws:
java.io.IOException - If an I/O error occurs

saveProperties

public void saveProperties(java.io.File cfgFile,
                           boolean merge)
                    throws java.io.IOException
Saves the properties contained in this RTProperties instance to a file

Parameters:
cfgFile - The file to which the properties are saved.
merge - True to merge the contained properties into the specified "cfgFile" (ignored if the specified file does not exist).
Throws:
java.io.IOException - If an I/O error occurs

toStringArray

public java.lang.String[] toStringArray(boolean dashPrefix)
Returns an array of strings representing the key/value pairs in this RTProperties

Parameters:
dashPrefix - True if the individual properties should be prefixed with a '-'
Returns:
The string array representation of thisRTProperties

toString

public java.lang.String toString()
Returns a string representation of this RTProperties

Overrides:
toString in class java.lang.Object
Returns:
A string reperesentation of this RTProperties

toString

public java.lang.String toString(RTProperties exclProps)
Returns a string representation of this RTProperties

Parameters:
exclProps - An RTProperties containing items to exclude
Returns:
A string reperesentation of this RTProperties

toString

public java.lang.String toString(java.util.Collection<?> orderBy)
Returns a string representation of this RTProperties

Parameters:
orderBy - A Collection of keys to order the properties by
Returns:
A string reperesentation of this RTProperties

toString

public java.lang.String toString(RTProperties exclProps,
                                 java.util.Collection<?> orderBy)
Returns a string representation of this RTProperties

Parameters:
exclProps - An RTProperties containing items to exclude
orderBy - A Collection of keys to order the properties by
Returns:
A string reperesentation of this RTProperties

toString

public java.lang.String toString(RTProperties exclProps,
                                 java.util.Collection<?> orderBy,
                                 java.lang.String newLinePrefix)
Returns a string representation of this RTProperties

Parameters:
exclProps - An RTProperties containing items to exclude
orderBy - A Collection of keys to order the properties by
newLinePrefix - A string to prefix new property lines with, for example, some spaces for indentation
Returns:
A string reperesentation of this RTProperties

main

public static void main(java.lang.String[] argv)
Main entry point for testing/debugging

Parameters:
argv - Comand-line arguments