jrunx.util
Class OrderedProperties

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--java.util.Properties
                    |
                    +--jrunx.util.OrderedProperties
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class OrderedProperties
extends java.util.Properties
implements java.io.Serializable

Properties extension that maintains the comment block that appears before each key,value pair and uses a Vector to maintain keys in order. In JRun23 branch, this class maps a key to a vector of values. In Matrix, this class maps a key to a value. store() method has been changed completely to reflect this design change.

See Also:
Serialized Form

Inner classes inherited from class java.util.Map
java.util.Map.Entry
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
OrderedProperties()
           
OrderedProperties(OrderedProperties props)
           
 
Method Summary
 void clear()
           
 void clearComments()
           
 boolean contains(java.lang.Object value)
           
 boolean containsKey(java.lang.String key)
           
 java.lang.Object get(java.lang.Object property)
           
 java.util.Properties getProperties(java.lang.String propPattern)
          Get the set of properties that match a specified pattern.
 java.lang.String getProperty(java.lang.String property)
           
 java.lang.String getProperty(java.lang.String property, java.lang.String defaultval)
           
 java.util.Enumeration keys()
           
 void load(java.io.InputStream is)
           
 void load(java.io.Reader reader)
           
 void load2(java.io.BufferedReader br)
           
static void main(java.lang.String[] args)
           
 java.util.Enumeration propertyNames()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 java.lang.Object putProperty(java.lang.String property, java.lang.String value)
           
 java.lang.Object putProperty(java.lang.String comment, java.lang.String property, java.lang.String value)
          Be careful..
 java.lang.Object remove(java.lang.Object key)
           
 void removeProperties(java.lang.String propPattern)
          Remove the set of properties that match the specified pattern.
 void replaceProperty(java.lang.String property, java.lang.String value)
          Replace a property in place, not adjusting the 'keys' vector.
 void save(java.io.OutputStream os, java.lang.String header)
           
 void setProperties(java.util.Properties props)
          Add set of properties to this object.
 java.lang.Object setProperty(java.lang.String property, java.lang.String value)
           
 int size()
           
 void store(java.io.OutputStream os)
           
 void store(java.io.OutputStream os, java.lang.String header)
           
 void store(java.io.PrintWriter writer)
           
 
Methods inherited from class java.util.Properties
list, list
 
Methods inherited from class java.util.Hashtable
clone, containsKey, containsValue, elements, entrySet, equals, hashCode, isEmpty, keySet, putAll, rehash, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OrderedProperties

public OrderedProperties()

OrderedProperties

public OrderedProperties(OrderedProperties props)
Method Detail

size

public int size()
Overrides:
size in class java.util.Hashtable

getProperty

public java.lang.String getProperty(java.lang.String property)
Overrides:
getProperty in class java.util.Properties

getProperty

public java.lang.String getProperty(java.lang.String property,
                                    java.lang.String defaultval)
Overrides:
getProperty in class java.util.Properties

replaceProperty

public void replaceProperty(java.lang.String property,
                            java.lang.String value)
Replace a property in place, not adjusting the 'keys' vector.

putProperty

public java.lang.Object putProperty(java.lang.String property,
                                    java.lang.String value)

setProperty

public java.lang.Object setProperty(java.lang.String property,
                                    java.lang.String value)
Overrides:
setProperty in class java.util.Properties

putProperty

public java.lang.Object putProperty(java.lang.String comment,
                                    java.lang.String property,
                                    java.lang.String value)
Be careful.. comment must be started with # sign.

get

public java.lang.Object get(java.lang.Object property)
Overrides:
get in class java.util.Hashtable

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Overrides:
put in class java.util.Hashtable

remove

public java.lang.Object remove(java.lang.Object key)
Overrides:
remove in class java.util.Hashtable

keys

public java.util.Enumeration keys()
Overrides:
keys in class java.util.Hashtable

propertyNames

public java.util.Enumeration propertyNames()
Overrides:
propertyNames in class java.util.Properties

clear

public void clear()
Overrides:
clear in class java.util.Hashtable

clearComments

public void clearComments()

contains

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

containsKey

public boolean containsKey(java.lang.String key)

getProperties

public java.util.Properties getProperties(java.lang.String propPattern)
Get the set of properties that match a specified pattern. The match pattern accepts a single '*' char anywhere in the pattern. If the '*' is placed somewhere in the middle of the pattern, then then the subset will contain properties that startWith everything before the '*' and end with everything after the '*'. Sample property patterns:
*.bar returns the subset of properties that end with '.bar'
bar.* returns the subset of properties that begin with 'bar.'
foo*bar returns the subset of properties that begin with 'foo' and end with 'bar'
Parameters:
propPattern - a pattern with 0 or 1 '*' chars.
Returns:
the subset of properties that match the specified pattern. Note that changing the properties in the returned subset will not affect this object.

removeProperties

public void removeProperties(java.lang.String propPattern)
Remove the set of properties that match the specified pattern. See getProperties(String) for more info about the pattern.
Parameters:
propPattern - a pattern with 0 or 1 '*' chars.

setProperties

public void setProperties(java.util.Properties props)
Add set of properties to this object. This method will replace the value of any properties that already existed.

load

public void load(java.io.InputStream is)
          throws java.io.IOException
Overrides:
load in class java.util.Properties

load

public void load(java.io.Reader reader)
          throws java.io.IOException

load2

public void load2(java.io.BufferedReader br)
           throws java.io.IOException

store

public void store(java.io.PrintWriter writer)

store

public void store(java.io.OutputStream os)

store

public void store(java.io.OutputStream os,
                  java.lang.String header)
Overrides:
store in class java.util.Properties

save

public void save(java.io.OutputStream os,
                 java.lang.String header)
Overrides:
save in class java.util.Properties

main

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


Copyright � 2002 Macromedia Corporation. All Rights Reserved.