|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opengts.util.RTProperties
public class RTProperties
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 |
---|
public static final java.lang.String PROP_usePropertiesLoad
public static final java.lang.String PROP_removeInlineComments
public static final java.lang.String NameStart
public static final java.lang.String NameEnd
public static final char[] KeyValSeparatorChars
public static final char PropertySeparatorChar
public static final char ARRAY_DELIM
public static final java.lang.String KEY_START_DELIMITER
public static final java.lang.String KEY_END_DELIMITER
public static final java.lang.String KEY_DFT_DELIMITER
public static final int KEY_MAX_RECURSION
public static final int KEY_REPLACEMENT_NONE
public static final int KEY_REPLACEMENT_LOCAL
public static final int KEY_REPLACEMENT_GLOBAL
public static final java.lang.String KEYVAL_PREFIX
public static final char KEYVAL_PREFIX_CHAR
public static final char KEYVAL_SEPARATOR_CHAR_1
public static final char KEYVAL_SEPARATOR_CHAR_2
public boolean DEBUG
protected static java.lang.Class<OrderedMap> DefaultMapClass
Constructor Detail |
---|
public RTProperties(java.util.Map<?,?> map)
map
- The Object key/value map used to initialize this instancepublic RTProperties()
public RTProperties(java.lang.String props)
props
- A String containing "key=value key=value ..." specifications used to
initialize this instance.public RTProperties(java.lang.String props, boolean inclName)
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.public RTProperties(java.lang.String props, char propSep)
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)public RTProperties(java.lang.String props, char propSep, char[] keyValSep)
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)public RTProperties(java.lang.String[] argv)
argv
- An array of "key=value" specifications.public RTProperties(java.io.File cfgFile)
cfgFile
- A file specification from which the key=value properties are loaded.public RTProperties(java.net.URL cfgURL)
cfgURL
- A URL specification from which the key=value properties are loaded.public RTProperties(java.io.InputStream in)
in
- An InputStream
from which the key=value properties are loaded.public RTProperties(RTProperties rtp)
rtp
- A RTProperties instance from this this instance is initializedMethod Detail |
---|
public static void setRemoveInlineComments(boolean ric)
public java.lang.Object clone()
clone
in class java.lang.Object
public java.util.List<java.net.URL> getLoadedURLs()
public boolean getIgnoreKeyCase()
public RTProperties setIgnoreKeyCase(boolean ignCase)
OrderedMap
.
ignCase
- True ignore key-case on lookups, false otherwisepublic boolean getAllowBlankValues()
public void setAllowBlankValues(boolean allowBlank)
allowBlank
- True to allow blank String valuespublic boolean getIncludesEnabled()
public void setIncludesEnabled(boolean enable)
enable
- True to enable, false to disablepublic boolean getConfigLogMessagesEnabled()
public void setConfigLogMessagesEnabled(boolean enable)
enable
- True to enable, false to disablepublic java.lang.String getName()
public void setName(java.lang.String name)
name
- The name of this instance to setpublic void checkDefaults()
protected static java.util.Map<java.lang.Object,java.lang.Object> CreateDefaultMap()
public int getNextCommandLineArgumentIndex()
public boolean validateKeyAttributes(java.lang.String[] keyAttr, boolean printErrors)
keyAttr
- A list of expected keys and attributes
public void addChangeListener(RTProperties.PropertyChangeListener pcl)
pcl
- A PropertyChangeListener to add to this instancepublic void removeChangeListener(RTProperties.PropertyChangeListener pcl)
pcl
- A PropertyChangeListener to remove from this instanceprotected void firePropertyChanged(java.lang.Object key, java.lang.Object oldVal)
key
- The property key which changedoldVal
- The old value of the property key which changedpublic void setBackingProperties(java.util.Map<?,?> map)
map
- The backing properties Map to set for this instancepublic java.util.Map<java.lang.Object,java.lang.Object> getProperties()
protected java.util.Map<java.lang.String,java.lang.String> getStringProperties()
protected java.util.Map<java.lang.Object,java.lang.Object> getImmutableProperties()
public int size()
public boolean isEmpty()
public java.util.Iterator<?> keyIterator()
public java.util.Set<?> getPropertyKeys()
public java.util.Set<java.lang.String> getPropertyKeys(java.lang.String startsWith)
public RTProperties getSubset(java.lang.String keyStartsWith)
keyStartsWith
- The partial key used to match keys in this instance
public static boolean containsKey(java.util.Map<java.lang.Object,java.lang.Object> map, java.lang.Object key, boolean blankOK)
key
- A property key
public boolean hasProperty(java.lang.Object[] keyList)
keyList
- A list of acceptable property keys
public boolean hasProperty(java.lang.Object key)
key
- A property key
public java.lang.String getFirstDefinedKey(java.lang.String[] key)
key
- An array of property keys
public java.lang.String getFirstDefinedKey(java.lang.String key)
key
- The propery key
public void setProperty(java.lang.Object key, java.lang.Object value)
setProperty
in interface RTConfig.PropertySetter
key
- The property keyvalue
- The value to associate with the specified keypublic java.lang.String setProperties(RTProperties rtp)
rtp
- The RTProperties instance from which properties will be copied to this instance
public java.lang.String setProperties(RTProperties rtp, boolean inclName)
rtp
- The RTProperties instance from which properties will be copied to this instanceinclName
- True to set the name of this instace to the instance of the specified RTProperties instance.
public java.lang.String setProperties(java.net.URL url) throws java.io.IOException
url
- The URL from which properties will be loaded to this instance
java.io.IOException
- If an I/O error occurspublic java.lang.String setProperties(java.net.URL url, boolean inclName) throws java.io.IOException
url
- The URL from which properties will be loaded to this instanceinclName
- True to set the name of this instace to the instance of the specified RTProperties instance.
java.io.IOException
- If an I/O error occurspublic java.lang.String setProperties(java.io.File file) throws java.io.IOException
file
- The file from which properties will be loaded to this instance
java.io.IOException
- If an I/O error occurspublic java.lang.String setProperties(java.io.File file, boolean inclName) throws java.io.IOException
file
- The file from which properties will be loaded to this instanceinclName
- True to set the name of this instace to the instance of the specified RTProperties instance.
java.io.IOException
- If an I/O error occurspublic java.lang.String setProperties(java.io.InputStream in) throws java.io.IOException
in
- The input stream from which properties will be loaded to this instance
java.io.IOException
- If an I/O error occurspublic java.lang.String setProperties(java.io.InputStream in, boolean inclName) throws java.io.IOException
in
- The input stream from which properties will be loaded to this instanceinclName
- True to set the name of this instace to the instance of the specified RTProperties instance.
java.io.IOException
- If an I/O error occurspublic java.lang.String setProperties(java.util.Map props)
Map
to this instance
props
- The map from which properties will be loaded to this instance
public java.lang.String setProperties(java.util.Map props, boolean inclName)
Map
to this instance
props
- The map from which properties will be loaded to this instanceinclName
- True to set the name of this instace to the instance of the specified RTProperties instance.
public void setPropertySeparatorChar(char propSep)
propSep
- The character to use to seperate propertiespublic char getPropertySeparatorChar()
public void setKeyValueSeparatorChars(char[] keyValSep)
keyValSep
- The array of key/value sperator characterspublic void setKeyValueSeparatorChar(char keyValSep)
keyValSep
- The key/value sperator characterpublic char[] getKeyValueSeparatorChars()
public char getKeyValueSeparatorChar()
public java.lang.String setProperties(java.lang.String props)
props
- The string from which the properties will be added
public java.lang.String setProperties(java.lang.String props, char propSep)
props
- The string from which the properties will be addedpropSep
- The character to set as the property seperator. Calls
setPropertySeparatorChar(char)
, which can affect futher
opperations
public java.lang.String setProperties(java.lang.String props, boolean inclName)
props
- The string from which the properties will be addedinclName
- True to set the name of this instace to the instance of the specified RTProperties instance
public void removeProperty(java.lang.Object key)
key
- The key of the property to removepublic void removeProperties(java.lang.Object key)
key
- The key of the property to removeremoveProperty(Object key)
public void removeProperties(java.lang.String[] keyArry)
keyArry
- The array of property keys to removepublic void removeProperties(RTProperties rtp)
rtp
- The RTProperties instance containing the keys to removepublic void clearProperties()
public void resetProperties(java.util.Map props)
props
- The properties to set this instance withpublic java.lang.String insertKeyValues(java.lang.String text)
text
- The target String
StringTools.insertKeyValues(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String[][])
public java.lang.String insertKeyValues(java.lang.String text, java.lang.String startDelim, java.lang.String endDelim)
text
- The target StringstartDelim
- The pattern used to determine the start of a 'key' variableendDelim
- The pattern used to determine the end of a key variable
StringTools.insertKeyValues(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String[][])
public java.lang.String _insertKeyValues(java.lang.Object key, java.lang.String text)
key
- The main keytext
- The target String
StringTools.insertKeyValues(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String[][])
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)
mainKey
- The main keytext
- The target StringstartDelim
- The pattern used to determine the start of a 'key' variableendDelim
- The pattern used to determine the end of a key variable
StringTools.insertKeyValues(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String[][])
public void setKeyReplacementMode(int mode)
mode
- The key replacement mode. One of the
KEY_REPLACEMENT_
constantspublic java.lang.Object _getProperty(java.lang.Object key, java.lang.Object dft)
key
- The key to get the property value ofdft
- 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>)
)
public java.lang.Object getProperty(java.lang.Object key, java.lang.Object dft)
getProperty
in interface RTConfig.PropertyGetter
key
- The key to get the property value ofdft
- 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>)
)
protected static java.lang.Object convertToType(java.lang.Object val, java.lang.Class<?> type) throws java.lang.Throwable
val
to the specified class
val
- The object to attempt to converttype
- The type to attempt to convert val
to
val
converted to type
Throwble
- If type conversion fails
java.lang.Throwable
public java.lang.String getString(java.lang.String key)
key
- The property key
public java.lang.String getString(java.lang.String[] key, java.lang.String dft)
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
public java.lang.String getString(java.lang.String key, java.lang.String dft)
key
- The property key.dft
- The default value return if the key is not found
public java.lang.String getString(java.lang.String key, java.lang.String dft, boolean replaceKeys)
key
- The property key.dft
- The default value return if the key is not foundreplaceKeys
- True to perform ${...} key replace, false to return raw String
public void setString(java.lang.String key, java.lang.String value)
key
- The property keyvalue
- The property value to set.public java.lang.String getKeyValue(java.lang.String key, java.lang.String arg, java.lang.String dft)
getKeyValue
in interface StringTools.KeyValueMap
key
- The property keyarg
- The property argument (not used here)dft
- The default value
public java.lang.String[] getStringArray(java.lang.String key)
key
- The key of the property
StringTools.parseArray(String s, char arrayDelim)
public java.lang.String[] getStringArray(java.lang.String[] key, java.lang.String[] dft)
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
StringTools.parseArray(String s, char arrayDelim)
public java.lang.String[] getStringArray(java.lang.String key, java.lang.String[] dft)
key
- The key of the propertydft
- The default value to return if an entry was not found
StringTools.parseArray(String s, char arrayDelim)
public void setStringArray(java.lang.String key, java.lang.String[] val)
key
- The key of the propertyval
- The value to set the property toStringTools.encodeArray(Object list[], char delim, boolean alwaysQuote)
,
StringTools.parseArray(String s, char arrayDelim)
public void setStringArray(java.lang.String key, java.lang.String[] val, boolean alwaysQuote)
key
- The key of the propertyval
- The value to set the property toalwaysQuote
- True if the strings in the encoded array should
always be quoted as literal values. Usually trueStringTools.encodeArray(Object list[], char delim, boolean alwaysQuote)
,
StringTools.parseArray(String s, char arrayDelim)
public void setProperty(java.lang.String key, java.lang.String[] val)
key
- The key of the propertyval
- The value to set the property toStringTools.encodeArray(Object list[], char delim, boolean alwaysQuote)
,
StringTools.parseArray(String s, char arrayDelim)
public java.lang.Class getClass(java.lang.String key)
Class
property at the specified key
key
- The key of the property
Class
value of the propertypublic java.lang.Class getClass(java.lang.String key, java.lang.Class dft)
Class
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
Class
value of the propertypublic void setClass(java.lang.String key, java.lang.Class value)
Class
key
- The key of the propertyvalue
- The value to set the property topublic java.io.File getFile(java.lang.String key)
File
property at the specified key
key
- The key of the property
File
value of the propertypublic java.io.File getFile(java.lang.String key, java.io.File dft)
File
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
File
value of the propertypublic void setFile(java.lang.String key, java.io.File value)
File
key
- The key of the propertyvalue
- The value to set the property topublic boolean isDouble(java.lang.String key, boolean strict)
double
key
- The key of the propertystrict
- 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.
double
valuepublic double getDouble(java.lang.String key)
double
property at the specified key
key
- The key of the property
double
value of the propertypublic double getDouble(java.lang.String[] key, double dft)
dobule
property at the specified key
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
double
value of the propertypublic double getDouble(java.lang.String key, double dft)
double
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
double
value of the propertypublic double[] getDoubleArray(java.lang.String key, double[] dft)
double
array property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
double
array value of the propertypublic void setDouble(java.lang.String key, double value)
double
value
key
- The key of the propertyvalue
- The value to set the property topublic void setDoubleArray(java.lang.String key, double[] value)
double
array value
key
- The key of the propertyvalue
- The value to set the property topublic void setProperty(java.lang.String key, double value)
double
value
key
- The key of the propertyvalue
- The value to set the property topublic boolean isFloat(java.lang.String key, boolean strict)
float
key
- The key of the propertystrict
- 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.
float
valuepublic float getFloat(java.lang.String key)
float
property at the specified key
key
- The key of the property
float
value of the propertypublic float getFloat(java.lang.String[] key, float dft)
float
property at the specified key
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
float
value of the propertypublic float getFloat(java.lang.String key, float dft)
float
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
float
value of the propertypublic float[] getFloatArray(java.lang.String key, float[] dft)
float
array property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
float
array value of the propertypublic void setFloat(java.lang.String key, float value)
float
value
key
- The key of the propertyvalue
- The value to set the property topublic void setFloatArray(java.lang.String key, float[] value)
float
array value
key
- The key of the propertyvalue
- The value to set the property topublic void setProperty(java.lang.String key, float value)
float
value
key
- The key of the propertyvalue
- The value to set the property topublic boolean isBigInteger(java.lang.String key, boolean strict)
BigInteger
key
- The key of the propertystrict
- 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.
BigInteger
valuepublic java.math.BigInteger getBigInteger(java.lang.String key)
BigInteger
property at the specified key
key
- The key of the property
BigInteger
value of the propertypublic java.math.BigInteger getBigInteger(java.lang.String[] key, java.math.BigInteger dft)
BigInteger
property at the specified key
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
BigInteger
value of the propertypublic java.math.BigInteger getBigInteger(java.lang.String key, java.math.BigInteger dft)
BigInteger
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
BigInteger
value of the propertypublic java.math.BigInteger[] getBigIntegerArray(java.lang.String key, java.math.BigInteger[] dft)
BigInteger
array property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
BigInteger
array value of the propertypublic void setBigInteger(java.lang.String key, java.math.BigInteger value)
BigInteger
value
key
- The key of the propertyvalue
- The value to set the property topublic void setBigIntegerArray(java.lang.String key, java.math.BigInteger[] value)
BigInteger
array value
key
- The key of the propertyvalue
- The value to set the property topublic void setProperty(java.lang.String key, java.math.BigInteger value)
BigInteger
value
key
- The key of the propertyvalue
- The value to set the property topublic boolean isLong(java.lang.String key, boolean strict)
long
key
- The key of the propertystrict
- 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.
long
valuepublic long getLong(java.lang.String key)
long
property at the specified key
key
- The key of the property
long
value of the propertypublic long getLong(java.lang.String[] key, long dft)
long
property at the specified key
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
long
value of the propertypublic long getLong(java.lang.String key, long dft)
long
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
long
value of the propertypublic long[] getLongArray(java.lang.String key, long[] dft)
long
array property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
long
array value of the propertypublic long[] getLongArray(java.lang.String[] key, long[] dft)
long
array property at the specified key
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
long
array value of the propertypublic void setLong(java.lang.String key, long value)
long
value
key
- The property keyvalue
- The valuepublic void setLongArray(java.lang.String key, long[] value)
long
array value
key
- The property keyvalue
- The valuepublic void setProperty(java.lang.String key, long value)
long
value
key
- The property keyvalue
- The valuepublic void setHexLong(java.lang.String key, long value)
long
value as a hex String
key
- The property keyvalue
- The valuepublic void setHexLong(java.lang.String key, long value, int bitLen)
long
value as a hex String
key
- The property keyvalue
- The valuebitLen
- The bit-width of the saved hex valuepublic boolean isInt(java.lang.String key, boolean strict)
int
key
- The key of the propertystrict
- 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.
int
valuepublic int getInt(java.lang.String key)
int
property at the specified key
key
- The key of the property
int
value of the propertypublic int getInt(java.lang.String[] key, int dft)
int
property at the specified key
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
int
value of the propertypublic int getInt(java.lang.String key, int dft)
int
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
int
value of the propertypublic int[] getIntArray(java.lang.String key, int[] dft)
int
array property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
int
array value of the propertypublic int[] getIntArray(java.lang.String[] key, int[] dft)
int
array property at the specified key
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
int
value of the propertypublic void setInt(java.lang.String key, int value)
int
value
key
- The property keyvalue
- The valuepublic void setIntArray(java.lang.String key, int[] value)
int
array value
key
- The property keyvalue
- The valuepublic void setProperty(java.lang.String key, int value)
int
value
key
- The property keyvalue
- The valuepublic void setHexInt(java.lang.String key, int value)
int
value as a hex String value
key
- The property keyvalue
- The valuepublic void setHexInt(java.lang.String key, int value, int bitLen)
int
value as a hex String value
key
- The property keyvalue
- The valuebitLen
- The bit-width of the saved hex valuepublic boolean isBoolean(java.lang.String key, boolean strict)
boolean
key
- The key of the propertystrict
- 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.
boolean
valuepublic boolean getBoolean(java.lang.String key)
boolean
property at the specified key
key
- The key of the property
boolean
value of the propertypublic boolean getBoolean(java.lang.String[] key, boolean dft)
boolean
property at the specified key
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
boolean
value of the propertypublic boolean getBoolean(java.lang.String key, boolean dft)
boolean
property at the specified key
key
- The key of the propertydft
- The default value to return if an entry was not found
boolean
value of the propertypublic void setBoolean(java.lang.String key, boolean value)
boolean
value
key
- The key of the propertyvalue
- The value to set the property topublic void setBooleanArray(java.lang.String key, boolean[] value)
boolean
array value
key
- The key of the propertyvalue
- The value to set the property topublic void setProperty(java.lang.String key, boolean value)
boolean
value
key
- The key of the propertyvalue
- The value to set the property topublic void printProperties(java.lang.String msg)
toString(RTProperties, Collection, String)
using Print.sysPrintln(java.lang.String, java.lang.Object...)
msg
- The first line printed, as a header for the properties listpublic void printProperties(java.lang.String msg, RTProperties exclProps)
toString(RTProperties, Collection, String)
using Print.sysPrintln(java.lang.String, java.lang.Object...)
msg
- The first line printed, as a header for the properties listexclProps
- An RTProperties
containing items to excludepublic void printProperties(java.lang.String msg, java.util.Collection<?> orderBy)
toString(RTProperties, Collection, String)
using Print.sysPrintln(java.lang.String, java.lang.Object...)
msg
- The first line printed, as a header for the properties listorderBy
- A Collection
of keys to order the properties bypublic void printProperties(java.lang.String msg, RTProperties exclProps, java.util.Collection<?> orderBy)
toString(RTProperties, Collection, String)
using Print.sysPrintln(java.lang.String, java.lang.Object...)
msg
- The first line printed, as a header for the properties listexclProps
- An RTProperties
containing items to excludeorderBy
- A Collection
of keys to order the properties bypublic void logProperties(java.lang.String msg)
toString(RTProperties, Collection, String)
using Print.sysPrintln(java.lang.String, java.lang.Object...)
msg
- The first line printed, as a header for the properties listpublic void logProperties(java.lang.String msg, RTProperties exclProps, java.util.Collection<?> orderBy)
toString(RTProperties, Collection, String)
using Print.sysPrintln(java.lang.String, java.lang.Object...)
msg
- The first line printed, as a header for the properties listexclProps
- An RTProperties
containing items to excludeorderBy
- A Collection
of keys to order the properties bypublic boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- The other object
public void saveProperties(java.io.File cfgFile) throws java.io.IOException
RTProperties
instance to a file
cfgFile
- The file to which the properties are saved.
java.io.IOException
- If an I/O error occurspublic void saveProperties(java.io.File cfgFile, boolean merge) throws java.io.IOException
RTProperties
instance to a file
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).
java.io.IOException
- If an I/O error occurspublic java.lang.String[] toStringArray(boolean dashPrefix)
RTProperties
dashPrefix
- True if the individual properties should be prefixed
with a '-'
RTProperties
public java.lang.String toString()
RTProperties
toString
in class java.lang.Object
RTProperties
public java.lang.String toString(RTProperties exclProps)
RTProperties
exclProps
- An RTProperties
containing items to exclude
RTProperties
public java.lang.String toString(java.util.Collection<?> orderBy)
RTProperties
orderBy
- A Collection
of keys to order the properties by
RTProperties
public java.lang.String toString(RTProperties exclProps, java.util.Collection<?> orderBy)
RTProperties
exclProps
- An RTProperties
containing items to excludeorderBy
- A Collection
of keys to order the properties by
RTProperties
public java.lang.String toString(RTProperties exclProps, java.util.Collection<?> orderBy, java.lang.String newLinePrefix)
RTProperties
exclProps
- An RTProperties
containing items to excludeorderBy
- A Collection
of keys to order the properties bynewLinePrefix
- A string to prefix new property lines with, for
example, some spaces for indentation
RTProperties
public static void main(java.lang.String[] argv)
argv
- Comand-line arguments
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |