ides.api.core
Class PersistentProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<java.lang.Object,java.lang.Object>
          extended by java.util.Properties
              extended by ides.api.core.PersistentProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

public class PersistentProperties
extends java.util.Properties

A convenience wrapper of Properties. It provides methods to get and set properties of types other than String. However, the underlying implementation uses strings to store the actual properties.

Author:
Lenko Grigorov
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
PersistentProperties()
           
 
Method Summary
 boolean getBoolean(java.lang.String key)
          Searches for the property with the specified key in this property list and parses the string value as a boolean.
 boolean getBoolean(java.lang.String key, boolean defaultValue)
          Searches for the property with the specified key in this property list and parses the string value as a boolean.
 int getInt(java.lang.String key)
          Searches for the property with the specified key in this property list and parses the string value as an integer.
 int getInt(java.lang.String key, int defaultValue)
          Searches for the property with the specified key in this property list and parses the string value as an integer.
 java.lang.Object setBoolean(java.lang.String key, boolean value)
          Calls the Hashtable method put.
 java.lang.Object setInt(java.lang.String key, int value)
          Calls the Hashtable method put.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PersistentProperties

public PersistentProperties()
Method Detail

getBoolean

public boolean getBoolean(java.lang.String key)
Searches for the property with the specified key in this property list and parses the string value as a boolean. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns false if the property is not found.

Parameters:
key - the property key
Returns:
the value in this property list with the specified key value.
See Also:
getBoolean(String, boolean), setBoolean(String, boolean)

getBoolean

public boolean getBoolean(java.lang.String key,
                          boolean defaultValue)
Searches for the property with the specified key in this property list and parses the string value as a boolean. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found.

Parameters:
key - the property key
defaultValue - a default value
Returns:
the value in this property list with the specified key value.
See Also:
setBoolean(String, boolean)

setBoolean

public java.lang.Object setBoolean(java.lang.String key,
                                   boolean value)
Calls the Hashtable method put. Provided for parallelism with the getProperty method. Enforces use of strings for property keys. Boolean values are properly formatted and stored as strings. The value returned is the result of the Hashtable call to put.

Parameters:
key - the key to be placed into this property list
value - the value corresponding to key
Returns:
the previous value of the specified key in this property list, or null if it did not have one.
See Also:
getBoolean(String), getBoolean(String, boolean)

getInt

public int getInt(java.lang.String key)
Searches for the property with the specified key in this property list and parses the string value as an integer. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns 0 if the property is not found.

Parameters:
key - the property key
Returns:
the value in this property list with the specified key value.
See Also:
getInt(String, int), setInt(String, int)

getInt

public int getInt(java.lang.String key,
                  int defaultValue)
Searches for the property with the specified key in this property list and parses the string value as an integer. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found.

Parameters:
key - the property key
defaultValue - a default value
Returns:
the value in this property list with the specified key value.
See Also:
setInt(String, int)

setInt

public java.lang.Object setInt(java.lang.String key,
                               int value)
Calls the Hashtable method put. Provided for parallelism with the getProperty method. Enforces use of strings for property keys. Integer values are properly formatted and stored as strings. The value returned is the result of the Hashtable call to put.

Parameters:
key - the key to be placed into this property list
value - the value corresponding to key
Returns:
the previous value of the specified key in this property list, or null if it did not have one.
See Also:
getInt(String), getInt(String, int)