com.rubecula.util
Class ConvenientProperties
java.lang.Object
java.util.Dictionary
java.util.Hashtable
java.util.Properties
com.rubecula.util.ConvenientProperties
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Map, java.io.Serializable
- Direct Known Subclasses:
- QuantityProperties
- public class ConvenientProperties
- extends java.util.Properties
Class to manage string properties with the following policy
imposed:
- Properties are sorted by key on output;
- Properties may have (optionally) a comment string (text following '# ');
- When value is retrieved, the comment and any white space is ignored;
- The comment string can be get/set with the appropriate methods.
- Since:
- V_0_5
- Version:
- $Revision: 1.2 $
- Author:
- Robin Hillyard
- See Also:
- Serialized Form
Nested classes inherited from class java.util.Hashtable |
|
Field Summary |
private static java.lang.String |
$S_HASH
|
Fields inherited from class java.util.Properties |
defaults |
Fields inherited from class java.util.Hashtable |
|
Method Summary |
java.lang.String |
getComment(java.lang.String key)
|
java.lang.String |
getProperty(java.lang.String key)
Method to get a property and strip off any comments and trailing spaces. |
java.util.Enumeration |
keys()
This method overrides the keys() method of HashTable
in order to force the Enumeration to be in alphabetical order. |
void |
list(java.io.PrintStream out)
|
void |
setComment(java.lang.String key,
java.lang.String comment)
|
Methods inherited from class java.util.Properties |
getProperty, list, load, propertyNames, save, setProperty, store |
Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, rehash, remove, size, toString, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
$S_HASH
private static final java.lang.String $S_HASH
- See Also:
- Constant Field Values
ConvenientProperties
public ConvenientProperties()
ConvenientProperties
public ConvenientProperties(java.util.Properties defaults)
- Parameters:
defaults
-
getProperty
public java.lang.String getProperty(java.lang.String key)
- Method to get a property and strip off any comments and trailing spaces.
- Parameters:
key
- the name of the property to get.
- Returns:
- the value of the property (with no trailing space or comments attached).
- See Also:
Properties.getProperty(java.lang.String)
list
public void list(java.io.PrintStream out)
getComment
public java.lang.String getComment(java.lang.String key)
- Returns:
- Returns the comment (if any) or null.
setComment
public void setComment(java.lang.String key,
java.lang.String comment)
- Parameters:
comment
- The comment to set.
keys
public java.util.Enumeration keys()
- This method overrides the keys() method of HashTable
in order to force the Enumeration to be in alphabetical order.
- See Also:
Dictionary.keys()