net.sf.doolin.util
Class TreeProperties<T>

java.lang.Object
  extended by net.sf.doolin.util.TreeProperties<T>
Type Parameters:
T - Type of objects stored in the tree properties.

public class TreeProperties<T>
extends Object

Wraps a property set or a map as a tree view.

Author:
Damien Coraboeuf

Constructor Summary
TreeProperties()
          Constructor for an empty tree.
TreeProperties(Map<String,T> map)
          Constructor from a map.
TreeProperties(Properties properties)
          Constructor from a property set.
 
Method Summary
 Iterable<Pair<String,TreeProperties<T>>> entries()
           
 T get(String key)
          Gets a value using a key.
 TreeProperties<T> getTree(String key)
          Gets a subtree using a key.
 void put(String key, T value)
          Registers a value using a key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeProperties

public TreeProperties()
Constructor for an empty tree.


TreeProperties

public TreeProperties(Map<String,T> map)
Constructor from a map.

Parameters:
map - Map

TreeProperties

public TreeProperties(Properties properties)
Constructor from a property set.

Parameters:
properties - Properties
Method Detail

entries

public Iterable<Pair<String,TreeProperties<T>>> entries()
Returns:
An iteration over all map entries in this tree.

get

public T get(String key)
Gets a value using a key. The key nodes are separated by dots (".").

Parameters:
key - Key
Returns:
Associated value or null

getTree

public TreeProperties<T> getTree(String key)
Gets a subtree using a key. The key nodes are separated by dots (".").

Parameters:
key - Key
Returns:
Associated tree or null

put

public void put(String key,
                T value)
Registers a value using a key. The key nodes are separated by dots (".").

Parameters:
key - Key
value - Value to store


Copyright © 2011. All Rights Reserved.