Class ExtendedProperties
- java.lang.Object
-
- java.util.Dictionary<K,V>
-
- java.util.Hashtable
-
- org.apache.commons.collections.ExtendedProperties
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map
@Deprecated(since="2021-04-30") public class ExtendedProperties extends java.util.Hashtable
Deprecated.Commons Collections 3 is in maintenance mode. Commons Collections 4 should be used instead.This class extends normal Java properties by adding the possibility to use the same key many times concatenating the value strings instead of overwriting them.Please consider using the
PropertiesConfiguration
class in Commons-Configuration as soon as it is released.The Extended Properties syntax is explained here:
-
Each property has the syntax
key = value
- The key may use any character but the equal sign '='.
- value may be separated on different lines if a backslash is placed at the end of the line that continues below.
- If value is a list of strings, each token is separated by a comma ','.
- Commas in each token are escaped placing a backslash right before the comma.
- Backslashes are escaped by using two consecutive backslashes i.e. \\
- If a key is used more than once, the values are appended as if they were on the same line separated with commas.
- Blank lines and lines starting with character '#' are skipped.
- If a property is named "include" (or whatever is defined by setInclude() and getInclude() and the value of that property is the full path to a file on disk, that file will be included into the ConfigurationsRepository. You can also pull in files relative to the parent configuration file. So if you have something like the following: include = additional.properties Then "additional.properties" is expected to be in the same directory as the parent configuration file. Duplicate name values will be replaced, so be careful.
Here is an example of a valid extended properties file:
# lines starting with # are comments # This is the simplest property key = value # A long property may be separated on multiple lines longvalue = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa # This is a property with many tokens tokens_on_a_line = first token, second token # This sequence generates exactly the same result tokens_on_multiple_lines = first token tokens_on_multiple_lines = second token # commas may be escaped in tokens commas.escaped = Hi\, what'up?
NOTE: this class has not been written for performance nor low memory usage. In fact, it's way slower than it could be and generates too much memory garbage. But since performance is not an issue during intialization (and there is not much time to improve it), I wrote it this way. If you don't like it, go ahead and tune it up!
- Since:
- Commons Collections 1.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ExtendedProperties()
Deprecated.Creates an empty extended properties object.ExtendedProperties(java.lang.String file)
Deprecated.Creates and loads the extended properties from the specified file.ExtendedProperties(java.lang.String file, java.lang.String defaultFile)
Deprecated.Creates and loads the extended properties from the specified file.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addProperty(java.lang.String key, java.lang.Object value)
Deprecated.Add a property to the configuration.void
clearProperty(java.lang.String key)
Deprecated.Clear a property in the configuration.void
combine(ExtendedProperties props)
Deprecated.Combines an existing Hashtable with this Hashtable.static ExtendedProperties
convertProperties(java.util.Properties props)
Deprecated.Convert a standard properties class into a configuration class.void
display()
Deprecated.Display the configuration for debugging purposes to System.out.boolean
getBoolean(java.lang.String key)
Deprecated.Get a boolean associated with the given configuration key.boolean
getBoolean(java.lang.String key, boolean defaultValue)
Deprecated.Get a boolean associated with the given configuration key.java.lang.Boolean
getBoolean(java.lang.String key, java.lang.Boolean defaultValue)
Deprecated.Get a boolean associated with the given configuration key.byte
getByte(java.lang.String key)
Deprecated.Get a byte associated with the given configuration key.byte
getByte(java.lang.String key, byte defaultValue)
Deprecated.Get a byte associated with the given configuration key.java.lang.Byte
getByte(java.lang.String key, java.lang.Byte defaultValue)
Deprecated.Get a byte associated with the given configuration key.double
getDouble(java.lang.String key)
Deprecated.Get a double associated with the given configuration key.double
getDouble(java.lang.String key, double defaultValue)
Deprecated.Get a double associated with the given configuration key.java.lang.Double
getDouble(java.lang.String key, java.lang.Double defaultValue)
Deprecated.Get a double associated with the given configuration key.float
getFloat(java.lang.String key)
Deprecated.Get a float associated with the given configuration key.float
getFloat(java.lang.String key, float defaultValue)
Deprecated.Get a float associated with the given configuration key.java.lang.Float
getFloat(java.lang.String key, java.lang.Float defaultValue)
Deprecated.Get a float associated with the given configuration key.java.lang.String
getInclude()
Deprecated.Gets the property value for including other properties files.int
getInt(java.lang.String name)
Deprecated.The purpose of this method is to get the configuration resource with the given name as an integer.int
getInt(java.lang.String name, int def)
Deprecated.The purpose of this method is to get the configuration resource with the given name as an integer, or a default value.int
getInteger(java.lang.String key)
Deprecated.Get a int associated with the given configuration key.int
getInteger(java.lang.String key, int defaultValue)
Deprecated.Get a int associated with the given configuration key.java.lang.Integer
getInteger(java.lang.String key, java.lang.Integer defaultValue)
Deprecated.Get a int associated with the given configuration key.java.util.Iterator
getKeys()
Deprecated.Get the list of the keys contained in the configuration repository.java.util.Iterator
getKeys(java.lang.String prefix)
Deprecated.Get the list of the keys contained in the configuration repository that match the specified prefix.java.util.List
getList(java.lang.String key)
Deprecated.Get a List of strings associated with the given configuration key.java.util.List
getList(java.lang.String key, java.util.List defaultValue)
Deprecated.Get a List of strings associated with the given configuration key.long
getLong(java.lang.String key)
Deprecated.Get a long associated with the given configuration key.long
getLong(java.lang.String key, long defaultValue)
Deprecated.Get a long associated with the given configuration key.java.lang.Long
getLong(java.lang.String key, java.lang.Long defaultValue)
Deprecated.Get a long associated with the given configuration key.java.util.Properties
getProperties(java.lang.String key)
Deprecated.Get a list of properties associated with the given configuration key.java.util.Properties
getProperties(java.lang.String key, java.util.Properties defaults)
Deprecated.Get a list of properties associated with the given configuration key.java.lang.Object
getProperty(java.lang.String key)
Deprecated.Gets a property from the configuration.short
getShort(java.lang.String key)
Deprecated.Get a short associated with the given configuration key.short
getShort(java.lang.String key, short defaultValue)
Deprecated.Get a short associated with the given configuration key.java.lang.Short
getShort(java.lang.String key, java.lang.Short defaultValue)
Deprecated.Get a short associated with the given configuration key.java.lang.String
getString(java.lang.String key)
Deprecated.Get a string associated with the given configuration key.java.lang.String
getString(java.lang.String key, java.lang.String defaultValue)
Deprecated.Get a string associated with the given configuration key.java.lang.String[]
getStringArray(java.lang.String key)
Deprecated.Get an array of strings associated with the given configuration key.java.util.Vector
getVector(java.lang.String key)
Deprecated.Get a Vector of strings associated with the given configuration key.java.util.Vector
getVector(java.lang.String key, java.util.Vector defaultValue)
Deprecated.Get a Vector of strings associated with the given configuration key.boolean
isInitialized()
Deprecated.Indicate to client code whether property resources have been initialized or not.void
load(java.io.InputStream input)
Deprecated.Load the properties from the given input stream.void
load(java.io.InputStream input, java.lang.String enc)
Deprecated.Load the properties from the given input stream and using the specified encoding.void
save(java.io.OutputStream output, java.lang.String header)
Deprecated.Save the properties to the given output stream.void
setInclude(java.lang.String inc)
Deprecated.Sets the property value for including other properties files.void
setProperty(java.lang.String key, java.lang.Object value)
Deprecated.Set a property, this will replace any previously set values.ExtendedProperties
subset(java.lang.String prefix)
Deprecated.Create an ExtendedProperties object that is a subset of this one.java.lang.String
testBoolean(java.lang.String value)
Deprecated.Test whether the string represent by value maps to a boolean value or not.-
Methods inherited from class java.util.Hashtable
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, toString, values
-
-
-
-
Constructor Detail
-
ExtendedProperties
public ExtendedProperties()
Deprecated.Creates an empty extended properties object.
-
ExtendedProperties
public ExtendedProperties(java.lang.String file) throws java.io.IOException
Deprecated.Creates and loads the extended properties from the specified file.- Parameters:
file
- the filename to load- Throws:
java.io.IOException
- if a file error occurs
-
ExtendedProperties
public ExtendedProperties(java.lang.String file, java.lang.String defaultFile) throws java.io.IOException
Deprecated.Creates and loads the extended properties from the specified file.- Parameters:
file
- the filename to loaddefaultFile
- a second filename to load default values from- Throws:
java.io.IOException
- if a file error occurs
-
-
Method Detail
-
isInitialized
public boolean isInitialized()
Deprecated.Indicate to client code whether property resources have been initialized or not.
-
getInclude
public java.lang.String getInclude()
Deprecated.Gets the property value for including other properties files. By default it is "include".- Returns:
- A String.
-
setInclude
public void setInclude(java.lang.String inc)
Deprecated.Sets the property value for including other properties files. By default it is "include".- Parameters:
inc
- A String.
-
load
public void load(java.io.InputStream input) throws java.io.IOException
Deprecated.Load the properties from the given input stream.- Parameters:
input
- the InputStream to load from- Throws:
java.io.IOException
- if an IO error occurs
-
load
public void load(java.io.InputStream input, java.lang.String enc) throws java.io.IOException
Deprecated.Load the properties from the given input stream and using the specified encoding.- Parameters:
input
- the InputStream to load fromenc
- the encoding to use- Throws:
java.io.IOException
- if an IO error occurs
-
getProperty
public java.lang.Object getProperty(java.lang.String key)
Deprecated.Gets a property from the configuration.- Parameters:
key
- property to retrieve- Returns:
- value as object. Will return user value if exists, if not then default value if exists, otherwise null
-
addProperty
public void addProperty(java.lang.String key, java.lang.Object value)
Deprecated.Add a property to the configuration. If it already exists then the value stated here will be added to the configuration entry. For example, ifresource.loader = file
is already present in the configuration and youaddProperty("resource.loader", "classpath")
Then you will end up with a Vector like the following:["file", "classpath"]
- Parameters:
key
- the key to addvalue
- the value to add
-
setProperty
public void setProperty(java.lang.String key, java.lang.Object value)
Deprecated.Set a property, this will replace any previously set values. Set values is implicitly a call to clearProperty(key), addProperty(key,value).- Parameters:
key
- the key to setvalue
- the value to set
-
save
public void save(java.io.OutputStream output, java.lang.String header) throws java.io.IOException
Deprecated.Save the properties to the given output stream.The stream is not closed, but it is flushed.
- Parameters:
output
- an OutputStream, may be nullheader
- a textual comment to act as a file header- Throws:
java.io.IOException
- if an IO error occurs
-
combine
public void combine(ExtendedProperties props)
Deprecated.Combines an existing Hashtable with this Hashtable.Warning: It will overwrite previous entries without warning.
- Parameters:
props
- the properties to combine
-
clearProperty
public void clearProperty(java.lang.String key)
Deprecated.Clear a property in the configuration.- Parameters:
key
- the property key to remove along with corresponding value
-
getKeys
public java.util.Iterator getKeys()
Deprecated.Get the list of the keys contained in the configuration repository.- Returns:
- an Iterator over the keys
-
getKeys
public java.util.Iterator getKeys(java.lang.String prefix)
Deprecated.Get the list of the keys contained in the configuration repository that match the specified prefix.- Parameters:
prefix
- the prefix to match- Returns:
- an Iterator of keys that match the prefix
-
subset
public ExtendedProperties subset(java.lang.String prefix)
Deprecated.Create an ExtendedProperties object that is a subset of this one. Take into account duplicate keys by using the setProperty() in ExtendedProperties.- Parameters:
prefix
- the prefix to get a subset for- Returns:
- a new independent ExtendedProperties
-
display
public void display()
Deprecated.Display the configuration for debugging purposes to System.out.
-
getString
public java.lang.String getString(java.lang.String key)
Deprecated.Get a string associated with the given configuration key.- Parameters:
key
- The configuration key.- Returns:
- The associated string.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a String.
-
getString
public java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
Deprecated.Get a string associated with the given configuration key.- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated string if key is found, default value otherwise.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a String.
-
getProperties
public java.util.Properties getProperties(java.lang.String key)
Deprecated.Get a list of properties associated with the given configuration key.- Parameters:
key
- The configuration key.- Returns:
- The associated properties if key is found.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a String/List.java.lang.IllegalArgumentException
- if one of the tokens is malformed (does not contain an equals sign).
-
getProperties
public java.util.Properties getProperties(java.lang.String key, java.util.Properties defaults)
Deprecated.Get a list of properties associated with the given configuration key.- Parameters:
key
- The configuration key.- Returns:
- The associated properties if key is found.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a String/List.java.lang.IllegalArgumentException
- if one of the tokens is malformed (does not contain an equals sign).
-
getStringArray
public java.lang.String[] getStringArray(java.lang.String key)
Deprecated.Get an array of strings associated with the given configuration key.- Parameters:
key
- The configuration key.- Returns:
- The associated string array if key is found.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a String/List.
-
getVector
public java.util.Vector getVector(java.lang.String key)
Deprecated.Get a Vector of strings associated with the given configuration key.- Parameters:
key
- The configuration key.- Returns:
- The associated Vector.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Vector.
-
getVector
public java.util.Vector getVector(java.lang.String key, java.util.Vector defaultValue)
Deprecated.Get a Vector of strings associated with the given configuration key.The list is a copy of the internal data of this object, and as such you may alter it freely.
- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated Vector.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Vector.
-
getList
public java.util.List getList(java.lang.String key)
Deprecated.Get a List of strings associated with the given configuration key.The list is a copy of the internal data of this object, and as such you may alter it freely.
- Parameters:
key
- The configuration key.- Returns:
- The associated List object.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a List.- Since:
- Commons Collections 3.2
-
getList
public java.util.List getList(java.lang.String key, java.util.List defaultValue)
Deprecated.Get a List of strings associated with the given configuration key.The list is a copy of the internal data of this object, and as such you may alter it freely.
- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated List.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a List.- Since:
- Commons Collections 3.2
-
getBoolean
public boolean getBoolean(java.lang.String key)
Deprecated.Get a boolean associated with the given configuration key.- Parameters:
key
- The configuration key.- Returns:
- The associated boolean.
- Throws:
java.util.NoSuchElementException
- is thrown if the key doesn't map to an existing object.java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Boolean.
-
getBoolean
public boolean getBoolean(java.lang.String key, boolean defaultValue)
Deprecated.Get a boolean associated with the given configuration key.- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated boolean.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Boolean.
-
getBoolean
public java.lang.Boolean getBoolean(java.lang.String key, java.lang.Boolean defaultValue)
Deprecated.Get a boolean associated with the given configuration key.- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated boolean if key is found and has valid format, default value otherwise.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Boolean.
-
testBoolean
public java.lang.String testBoolean(java.lang.String value)
Deprecated.Test whether the string represent by value maps to a boolean value or not. We will allowtrue
,on
, andyes
for atrue
boolean value, andfalse
,off
, andno
forfalse
boolean values. Case of value to test for boolean status is ignored.- Parameters:
value
- the value to test for boolean state- Returns:
true
orfalse
if the supplied text maps to a boolean value, ornull
otherwise.
-
getByte
public byte getByte(java.lang.String key)
Deprecated.Get a byte associated with the given configuration key.- Parameters:
key
- The configuration key.- Returns:
- The associated byte.
- Throws:
java.util.NoSuchElementException
- is thrown if the key doesn't map to an existing object.java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Byte.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getByte
public byte getByte(java.lang.String key, byte defaultValue)
Deprecated.Get a byte associated with the given configuration key.- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated byte.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Byte.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getByte
public java.lang.Byte getByte(java.lang.String key, java.lang.Byte defaultValue)
Deprecated.Get a byte associated with the given configuration key.- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated byte if key is found and has valid format, default value otherwise.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Byte.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getShort
public short getShort(java.lang.String key)
Deprecated.Get a short associated with the given configuration key.- Parameters:
key
- The configuration key.- Returns:
- The associated short.
- Throws:
java.util.NoSuchElementException
- is thrown if the key doesn't map to an existing object.java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Short.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getShort
public short getShort(java.lang.String key, short defaultValue)
Deprecated.Get a short associated with the given configuration key.- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated short.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Short.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getShort
public java.lang.Short getShort(java.lang.String key, java.lang.Short defaultValue)
Deprecated.Get a short associated with the given configuration key.- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated short if key is found and has valid format, default value otherwise.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Short.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getInt
public int getInt(java.lang.String name)
Deprecated.The purpose of this method is to get the configuration resource with the given name as an integer.- Parameters:
name
- The resource name.- Returns:
- The value of the resource as an integer.
-
getInt
public int getInt(java.lang.String name, int def)
Deprecated.The purpose of this method is to get the configuration resource with the given name as an integer, or a default value.- Parameters:
name
- The resource namedef
- The default value of the resource.- Returns:
- The value of the resource as an integer.
-
getInteger
public int getInteger(java.lang.String key)
Deprecated.Get a int associated with the given configuration key.- Parameters:
key
- The configuration key.- Returns:
- The associated int.
- Throws:
java.util.NoSuchElementException
- is thrown if the key doesn't map to an existing object.java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Integer.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getInteger
public int getInteger(java.lang.String key, int defaultValue)
Deprecated.Get a int associated with the given configuration key.- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated int.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Integer.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getInteger
public java.lang.Integer getInteger(java.lang.String key, java.lang.Integer defaultValue)
Deprecated.Get a int associated with the given configuration key.- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated int if key is found and has valid format, default value otherwise.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Integer.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getLong
public long getLong(java.lang.String key)
Deprecated.Get a long associated with the given configuration key.- Parameters:
key
- The configuration key.- Returns:
- The associated long.
- Throws:
java.util.NoSuchElementException
- is thrown if the key doesn't map to an existing object.java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Long.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getLong
public long getLong(java.lang.String key, long defaultValue)
Deprecated.Get a long associated with the given configuration key.- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated long.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Long.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getLong
public java.lang.Long getLong(java.lang.String key, java.lang.Long defaultValue)
Deprecated.Get a long associated with the given configuration key.- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated long if key is found and has valid format, default value otherwise.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Long.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getFloat
public float getFloat(java.lang.String key)
Deprecated.Get a float associated with the given configuration key.- Parameters:
key
- The configuration key.- Returns:
- The associated float.
- Throws:
java.util.NoSuchElementException
- is thrown if the key doesn't map to an existing object.java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Float.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getFloat
public float getFloat(java.lang.String key, float defaultValue)
Deprecated.Get a float associated with the given configuration key.- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated float.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Float.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getFloat
public java.lang.Float getFloat(java.lang.String key, java.lang.Float defaultValue)
Deprecated.Get a float associated with the given configuration key.- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated float if key is found and has valid format, default value otherwise.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Float.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getDouble
public double getDouble(java.lang.String key)
Deprecated.Get a double associated with the given configuration key.- Parameters:
key
- The configuration key.- Returns:
- The associated double.
- Throws:
java.util.NoSuchElementException
- is thrown if the key doesn't map to an existing object.java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Double.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getDouble
public double getDouble(java.lang.String key, double defaultValue)
Deprecated.Get a double associated with the given configuration key.- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated double.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Double.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
getDouble
public java.lang.Double getDouble(java.lang.String key, java.lang.Double defaultValue)
Deprecated.Get a double associated with the given configuration key.- Parameters:
key
- The configuration key.defaultValue
- The default value.- Returns:
- The associated double if key is found and has valid format, default value otherwise.
- Throws:
java.lang.ClassCastException
- is thrown if the key maps to an object that is not a Double.java.lang.NumberFormatException
- is thrown if the value mapped by the key has not a valid number format.
-
convertProperties
public static ExtendedProperties convertProperties(java.util.Properties props)
Deprecated.Convert a standard properties class into a configuration class.NOTE: From Commons Collections 3.2 this method will pick up any default parent Properties of the specified input object.
- Parameters:
props
- the properties object to convert- Returns:
- new ExtendedProperties created from props
-
-