: Class PropertyTree

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mortbay.Util
Class PropertyTree

    java.lang.Object
      |
      +--java.util.Dictionary
            |
            +--java.util.Hashtable
                  |
                  +--java.util.Properties
                        |
                        +--com.mortbay.Util.PropertyTree

public class PropertyTree
extends java.util.Properties

Property map with keys in tree hierarchy. Extension of Properties to allow nesting of Properties and default values This class extends Properties and uses a "." separated notation to allow nesting of property values. Property keys such as "a.b" and "a.c" cat be retrieved (and set) as normal, but it is possible to retrieve a PropertyTree by get("a"), and then use get("b") and get("c") to achieve the same thing (although most times this is unnecessary). This makes it easy to have nested sets of values in the same properties file and iterate over nested keys. Wildcard nodes can be defined with "*" so that keys such as "aa.*.cc", will match gets such as "aa.bb.cc", "aa.X.cc", etc. Values can contain tokens such as %name%, which are expanded as with the results of a call to System.getProperty("name"); The % character may be included in a value with %%. To aid in constructing and saving Properties files, `getConverter` will convert Dictionaries into PropertyTrees recursively.

See Also:
  Serialized Form

Fields inherited from class java.util.Properties
`defaults`

Constructor Summary
`PropertyTree()` Constructor.
`PropertyTree(boolean trimLoadValues)` Constructor.
`PropertyTree(java.util.Properties properties)` Construct from Properties

Method Summary
`java.lang.Object` | `clone()`
`java.util.Enumeration` | `elements()`
`java.lang.Object` | `get(java.lang.Object key)` Override Hashtable.get()
`boolean` | `getBoolean(java.lang.String key)`
`boolean` | `getBoolean(java.lang.String key, boolean inDefault)`
`static Converter` | `getConverter()`
`java.util.Enumeration` | `getNodes()` Enumerate top level tree node names.
`java.util.Enumeration` | `getNodes(java.lang.String key)` Enumerate tree node names below given node.
`java.lang.StringBuffer` | `getPrefix()`
`java.lang.String` | `getProperty(java.lang.String key)` Override Properties.getProperty()
`java.util.Enumeration` | `getRealNodes()` Enumerate non wild tree node names below given node.
`java.util.Enumeration` | `getRealNodes(java.lang.String key)` Enumerate non wild tree node names below given node.
`PropertyTree` | `getTree(java.lang.String key)` Return a sub tree of the PropertyTree.
`java.util.Vector` | `getVector(java.lang.String key, java.lang.String separators)` Get Vector of values.
`void` | `load(java.io.InputStream in)`
`void` | `load(java.util.Properties properties)`
`java.util.Enumeration` | `propertyNames()`
`java.lang.Object` | `put(java.lang.Object key, java.lang.Object value)` Override Hashtable.put()
`java.lang.Object` | `remove(java.lang.Object key)` Override Hashtable.remove()
`void` | `save(java.io.OutputStream out, java.lang.String header)` From Properties
`java.lang.Object` | `setProperty(java.lang.String key, java.lang.String value)`

Methods inherited from class java.util.Properties
`getProperty, list, list, store`

Methods inherited from class java.util.Hashtable
`clear, contains, containsKey, containsValue, entrySet, equals, hashCode, isEmpty, keys, keySet, putAll, rehash, size, toString, values`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### PropertyTree

    public PropertyTree()

  Constructor. Equivalent to PropertyTree(true);

### PropertyTree

    public PropertyTree(boolean trimLoadValues)

  Constructor.
  Parameters:
    `trimLoadValues` - If true, all values are trimmed during loads.

### PropertyTree

    public PropertyTree(java.util.Properties properties)

  Construct from Properties
  Parameters:
    `properties` -

Method Detail

### load

    public void load(java.io.InputStream in)
              throws java.io.IOException

  Overrides:
    load in class java.util.Properties

### load

    public void load(java.util.Properties properties)

### get

    public java.lang.Object get(java.lang.Object key)

  Override Hashtable.get()
  Overrides:
    get in class java.util.Hashtable

### getProperty

    public java.lang.String getProperty(java.lang.String key)

  Override Properties.getProperty()
  Overrides:
    getProperty in class java.util.Properties

### put

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

  Override Hashtable.put()
  Overrides:
    put in class java.util.Hashtable

### setProperty

    public java.lang.Object setProperty(java.lang.String key,
                                        java.lang.String value)

  Overrides:
    setProperty in class java.util.Properties

### remove

    public java.lang.Object remove(java.lang.Object key)

  Override Hashtable.remove()
  Overrides:
    remove in class java.util.Hashtable

### save

    public void save(java.io.OutputStream out,
                     java.lang.String header)

  From Properties
  Overrides:
    save in class java.util.Properties

### getTree

    public PropertyTree getTree(java.lang.String key)

  Return a sub tree of the PropertyTree. Changes made in the sub tree are reflected in the original tree, unless the sub tree is cloned.
  Parameters:
    `name` - The name of the sub node
  Returns:
    null if none.

### getPrefix

    public java.lang.StringBuffer getPrefix()

### propertyNames

    public java.util.Enumeration propertyNames()

  Overrides:
    propertyNames in class java.util.Properties

### elements

    public java.util.Enumeration elements()

  Overrides:
    elements in class java.util.Hashtable

### getNodes

    public java.util.Enumeration getNodes()

  Enumerate top level tree node names.
  Returns:
    Enumeration of tree node names.

### getNodes

    public java.util.Enumeration getNodes(java.lang.String key)

  Enumerate tree node names below given node.
  Parameters:
    `key` - Key of the node.
  Returns:
    Enumeration of tree node names.

### getRealNodes

    public java.util.Enumeration getRealNodes()

  Enumerate non wild tree node names below given node.
  Parameters:
    `wild` - If false, only non-wild nodes are returned.
  Returns:
    Enumeration of tree node names.

### getRealNodes

    public java.util.Enumeration getRealNodes(java.lang.String key)

  Enumerate non wild tree node names below given node.
  Parameters:
    `key` - Key of the node.
    `wild` - If false, only non-wild nodes are returned.
  Returns:
    Enumeration of tree node names.

### getVector

    public java.util.Vector getVector(java.lang.String key,
                                      java.lang.String separators)

  Get Vector of values.
  Parameters:
    `key` - the Value(s) to get.
    `separators` - String of separator charactors
  Returns:
    Vector of values.

### getBoolean

    public boolean getBoolean(java.lang.String key)

### getBoolean

    public boolean getBoolean(java.lang.String key,
                              boolean inDefault)

### clone

    public java.lang.Object clone()

  Overrides:
    clone in class java.util.Hashtable

### getConverter

    public static Converter getConverter()

  Returns:
    A Converter for converting Dictionaries into PropertyTrees

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD