|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.util.Dictionary
java.util.Hashtable
java.util.Properties
org.jaffa.util.ListProperties
This class combines the utility of the Properties class with a List. Features are: 1) Maintains the order of properties when loading them from an InputStream and when the properties are added manually. 2) Provides a sort capability for the properties 3) Provides a 'comments' attribute for each property 4) Stores the properties in an OutputStream, maintaining the order of the properties and the comments NOTE: Even though this class extends HashTable (since Properties extends HashTable), this implementation is not synchronized !!
| Field Summary |
| Fields inherited from class java.util.Properties |
defaults |
| Constructor Summary | |
ListProperties()
Creates an empty property list with no default values. |
|
ListProperties(Properties defaults)
Creates an empty property list with the specified defaults. |
|
| Method Summary | |
void |
clear()
Removes all mappings from this map. |
Object |
clone()
Returns a clone of this object. |
boolean |
containsKey(Object key)
Returns true if this map contains a mapping for the specified key. |
boolean |
containsValue(Object value)
Returns true if this map maps one or more keys to the specified value. |
Enumeration |
elements()
Returns an enumeration of the values in this hashtable. |
Set |
entrySet()
Returns a set view of the mappings contained in this map. |
boolean |
equals(Object o)
Compares the specified object with this map for equality. |
Object |
get(Object key)
Returns the value to which this map maps the specified key. |
String |
getComments(String key)
Returns the comments for the property. |
String |
getProperty(String key)
Searches for the property with the specified key in this property list. |
String |
getProperty(String key,
String defaultValue)
Searches for the property with the specified key in this property list. |
int |
hashCode()
Returns the hash code value for this map. |
boolean |
isEmpty()
Returns true if this map contains no key-value mappings. |
Enumeration |
keys()
Returns an enumeration of the keys in this hashtable. |
Set |
keySet()
Returns a set view of the keys contained in this map. |
void |
list(PrintStream out)
Prints this property list out to the specified output stream. |
void |
list(PrintWriter out)
Prints this property list out to the specified output stream. |
void |
load(InputStream inStream)
Reads a property list (key and element pairs) from the input stream. |
Enumeration |
propertyNames()
Returns an enumeration of all the keys in this property list, including distinct keys in the default property list if a key of the same name has not already been found from the main properties list. |
Object |
put(Object key,
Object value)
Adds an object to the Map. |
void |
putAll(Map t)
Copies all of the mappings from the specified map to this map. |
Object |
remove(Object key)
Removes the mapping for this key from this map if it is present. |
void |
setComments(String key,
String comments)
Sets the comments for the property. |
Object |
setProperty(String key,
String value)
Adds a new property, or updates if it already exists. |
Object |
setProperty(String key,
String value,
String comments)
Adds a new property, or updates if it already exists. |
int |
size()
Returns the number of key-value mappings in this map. |
void |
sort()
This sorts the Properties based on the keys. |
void |
store(OutputStream out,
String header)
Writes this property list (key and element pairs) in this Properties table to the output stream. |
String |
toString()
Returns debug info. |
Collection |
values()
Returns a collection view of the values contained in this map. |
| Methods inherited from class java.util.Properties |
save |
| Methods inherited from class java.util.Hashtable |
contains, rehash |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ListProperties()
public ListProperties(Properties defaults)
defaults - The defaults.| Method Detail |
public void sort()
public String getComments(String key)
key - The key used for adding the property.
public void setComments(String key,
String comments)
key - The key used for adding the property.comments - The comments for the property.
public Object setProperty(String key,
String value,
String comments)
key - The key for the property.value - The value for the property.comments - The comment for the property.
public String toString()
public void load(InputStream inStream)
throws IOException
inStream - the input stream
IOException - if an error occurred when reading from the input stream.
public Object setProperty(String key,
String value)
key - The key for the property.value - The value for the property.
public String getProperty(String key)
key - the property key.
public String getProperty(String key,
String defaultValue)
key - the property key.defaultValue - a default value.
public Enumeration propertyNames()
public void store(OutputStream out,
String header)
throws IOException
out - an output stream.header - a description of the property list.
IOException - if writing this property list to the specified output stream throws an IOException.public void list(PrintStream out)
out - an output stream.public void list(PrintWriter out)
out - an output stream.
public Object put(Object key,
Object value)
key - The key used for adding the object.value - The object to be added.
public Object remove(Object key)
key - key whose mapping is to be removed from the map.
public Set keySet()
public void clear()
public Collection values()
public int hashCode()
public boolean containsKey(Object key)
key - key whose presence in this map is to be tested.
public int size()
public Set entrySet()
public boolean containsValue(Object value)
value - value whose presence in this map is to be tested.
public void putAll(Map t)
t - Mappings to be stored in this map.public boolean equals(Object o)
o - object to be compared for equality with this map.
public boolean isEmpty()
public Object get(Object key)
key - key whose associated value is to be returned.
public Enumeration elements()
public Enumeration keys()
public Object clone()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||