org.jutil.util
Class DynamicProperties

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 org.jutil.util.DynamicProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>

public class DynamicProperties
extends java.util.Properties

See Also:
Serialized Form

Field Summary
protected  java.io.File file
           
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
DynamicProperties(java.io.File file)
           
 
Method Summary
 void clear()
          Clears this hashtable so that it contains no keys.
 java.lang.Object clone()
          Creates a shallow copy of this hashtable.
 boolean contains(java.lang.Object value)
           
 boolean containsKey(java.lang.Object key)
           
 java.util.Enumeration elements()
          Returns an enumeration of the values in this hashtable.
 java.lang.Object get(java.lang.Object key)
           
 java.lang.String getProperty(java.lang.String key)
          Searches for the property with the specified key in this property list.
 java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
          Searches for the property with the specified key in this property list.
 boolean isEmpty()
          Tests if this hashtable maps no keys to values.
 java.util.Enumeration keys()
          Returns an enumeration of the keys in this hashtable.
 void list(java.io.PrintStream out)
          Prints this property list out to the specified output stream.
 void list(java.io.PrintWriter out)
          Prints this property list out to the specified output stream.
static void main(java.lang.String[] args)
           
 java.util.Enumeration propertyNames()
          Returns an enumeration of all the keys in this property list, including the keys in the default property list.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value, boolean write)
           
 java.lang.Object remove(java.lang.Object key)
           
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.util.Properties
load, load, loadFromXML, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
containsValue, entrySet, equals, hashCode, keySet, putAll, rehash, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

file

protected java.io.File file
Constructor Detail

DynamicProperties

public DynamicProperties(java.io.File file)
                  throws java.io.IOException
Throws:
java.io.IOException
Method Detail

main

public static void main(java.lang.String[] args)

getProperty

public java.lang.String getProperty(java.lang.String key)
Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns null if the property is not found.

Overrides:
getProperty in class java.util.Properties
Parameters:
key - the property key.
Returns:
the value in this property list with the specified key value.
Since:
JDK1.0
See Also:
Properties.defaults

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String defaultValue)
Searches for the property with the specified key in this property list. 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.

Overrides:
getProperty in class java.util.Properties
Parameters:
key - the hashtable key.
defaultValue - a default value.
Returns:
the value in this property list with the specified key value.
Since:
JDK1.0
See Also:
Properties.defaults

propertyNames

public java.util.Enumeration propertyNames()
Returns an enumeration of all the keys in this property list, including the keys in the default property list.

Overrides:
propertyNames in class java.util.Properties
Returns:
an enumeration of all the keys in this property list, including the keys in the default property list.
Since:
JDK1.0
See Also:
Enumeration, Properties.defaults

list

public void list(java.io.PrintStream out)
Prints this property list out to the specified output stream. This method is useful for debugging.

Overrides:
list in class java.util.Properties
Parameters:
out - an output stream.
Since:
JDK1.0

list

public void list(java.io.PrintWriter out)
Prints this property list out to the specified output stream. This method is useful for debugging.

Overrides:
list in class java.util.Properties
Parameters:
out - an output stream.
Since:
JDK1.1

size

public int size()
Specified by:
size in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
size in class java.util.Hashtable<java.lang.Object,java.lang.Object>

isEmpty

public boolean isEmpty()
Tests if this hashtable maps no keys to values.

Specified by:
isEmpty in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
isEmpty in class java.util.Hashtable<java.lang.Object,java.lang.Object>
Returns:
true if this hashtable maps no keys to values; false otherwise.
Since:
JDK1.0

keys

public java.util.Enumeration keys()
Returns an enumeration of the keys in this hashtable.

Overrides:
keys in class java.util.Hashtable<java.lang.Object,java.lang.Object>
Returns:
an enumeration of the keys in this hashtable.
Since:
JDK1.0
See Also:
Enumeration, Hashtable.elements()

elements

public java.util.Enumeration elements()
Returns an enumeration of the values in this hashtable. Use the Enumeration methods on the returned object to fetch the elements sequentially.

Overrides:
elements in class java.util.Hashtable<java.lang.Object,java.lang.Object>
Returns:
an enumeration of the values in this hashtable.
Since:
JDK1.0
See Also:
Enumeration, Hashtable.keys()

contains

public boolean contains(java.lang.Object value)
Overrides:
contains in class java.util.Hashtable<java.lang.Object,java.lang.Object>

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
containsKey in class java.util.Hashtable<java.lang.Object,java.lang.Object>

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
get in class java.util.Hashtable<java.lang.Object,java.lang.Object>

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
put in class java.util.Hashtable<java.lang.Object,java.lang.Object>

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value,
                            boolean write)

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
remove in class java.util.Hashtable<java.lang.Object,java.lang.Object>

clear

public void clear()
Clears this hashtable so that it contains no keys.

Specified by:
clear in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
clear in class java.util.Hashtable<java.lang.Object,java.lang.Object>
Since:
JDK1.0

clone

public java.lang.Object clone()
Creates a shallow copy of this hashtable. The keys and values themselves are not cloned. This is a relatively expensive operation.

Overrides:
clone in class java.util.Hashtable<java.lang.Object,java.lang.Object>
Returns:
a clone of the hashtable.
Since:
JDK1.0

toString

public java.lang.String toString()
Overrides:
toString in class java.util.Hashtable<java.lang.Object,java.lang.Object>