Coinjema
1.7

org.coinjema.collections
Class ConfigurationTree

java.lang.Object
  extended by org.coinjema.collections.ConfigurationTree
All Implemented Interfaces:
Serializable, Cloneable

public class ConfigurationTree
extends Object
implements Serializable, Cloneable

Author:
Michael Stover (mstover1 at apache.org) TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates
See Also:
Serialized Form

Constructor Summary
ConfigurationTree()
           
ConfigurationTree(ListedHashTree<String> data)
           
ConfigurationTree(ListedHashTree<String> data, String value)
           
ConfigurationTree(Reader r)
           
ConfigurationTree(String value)
           
 
Method Summary
 void add(Collection<String> keys)
           
 void add(Collection<String> treePath, Collection<String> values)
           
 ConfigurationTree add(Collection<String> treePath, String value)
           
 void add(Collection<String> treePath, String[] values)
           
 void add(ConfigurationTree newTree)
           
 void add(Properties props)
           
 ConfigurationTree add(String key)
           
 void add(String[] keys)
           
 void add(String[] treePath, Collection<String> values)
           
 ConfigurationTree add(String[] treePath, String value)
           
 void add(String[] treePath, String[] values)
           
 void add(String key, Collection<String> values)
           
 void add(String key, ConfigurationTree subTree)
           
 ConfigurationTree add(String key, String value)
           
 void add(String key, String[] values)
           
 ConfigurationTree addRaw(String key)
           
 ConfigurationTree addRaw(String key, String value)
           
protected  ConfigurationTree addTreePath(Collection<String> treePath)
           
 void clear()
           
protected  Object clone()
           
 boolean containsKey(String o)
           
 boolean containsValue(String value)
           
 Properties getAsProperties()
           
protected  Properties getAsProperties(ConfigurationTree tree)
           
 Properties getAsProperties(String key)
           
protected  String[] getPath(String key)
           
 String getProperty(String key)
           
 String getProperty(String[] keys)
           
 String getProperty(String[] keys, String def)
           
 String getProperty(String key, String def)
           
 String[] getPropertyNames()
           
 String[] getPropertyNames(Collection<String> treePath)
           
 String[] getPropertyNames(String key)
           
 String[] getPropertyNames(String[] treePath)
           
protected  void getSpaces(int level, Writer buf)
           
 ConfigurationTree getTree(Collection<String> treePath)
           
 ConfigurationTree getTree(String key)
           
 ConfigurationTree getTree(String[] treePath)
           
protected  ConfigurationTree getTreePath(Collection<String> treePath)
           
 String getValue()
           
 String getValue(String name)
           
 String getValue(String key, String def)
           
 String getValueOr(String def)
          Get the value or return the given default value if null
 boolean isEmpty()
           
protected  boolean isLeaf(String key)
           
 Collection<String> listPropertyNames()
           
 Collection<String> listPropertyNames(Collection<String> treePath)
           
 Collection<String> listPropertyNames(String key)
           
 Collection<String> listPropertyNames(String[] treePath)
           
protected  Collection<String> purgeValue(Collection<String> l)
           
 String put(String key, String value)
           
 String remove(String key)
           
 void replace(String currentKey, String newKey)
           
 ConfigurationTree search(String key)
           
 void setProperty(Collection<String> values)
           
 void setProperty(Collection<String> treePath, Collection<String> values)
           
 void setProperty(Collection<String> treePath, String[] values)
           
 void setProperty(String[] treePath, Collection<String> values)
           
 void setProperty(String[] treePath, String[] values)
           
 void setProperty(String key, Collection<String> values)
           
 void setProperty(String key, ConfigurationTree t)
           
 void setProperty(String key, String value)
           
 void setProperty(String key, String[] values)
           
 void setValue(String value)
           
 void setValue(String name, String value)
           
 int size()
           
 String toString()
           
 void traverse(HashTreeTraverser<String> visitor)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConfigurationTree

public ConfigurationTree()

ConfigurationTree

public ConfigurationTree(Reader r)
                  throws IOException
Throws:
IOException

ConfigurationTree

public ConfigurationTree(String value)

ConfigurationTree

public ConfigurationTree(ListedHashTree<String> data)

ConfigurationTree

public ConfigurationTree(ListedHashTree<String> data,
                         String value)
Method Detail

add

public void add(Collection<String> keys)
Parameters:
keys -

add

public void add(Collection<String> treePath,
                Collection<String> values)
Parameters:
treePath -
values -

add

public ConfigurationTree add(Collection<String> treePath,
                             String value)
Parameters:
treePath -
value -
Returns:

add

public void add(Collection<String> treePath,
                String[] values)
Parameters:
treePath -
values -

add

public void add(ConfigurationTree newTree)
Parameters:
newTree -

add

public ConfigurationTree add(String key)
Parameters:
key -
Returns:

addRaw

public ConfigurationTree addRaw(String key,
                                String value)

addRaw

public ConfigurationTree addRaw(String key)

add

public void add(String key,
                Collection<String> values)
Parameters:
key -
values -

add

public void add(String key,
                ConfigurationTree subTree)
Parameters:
key -
subTree -

add

public ConfigurationTree add(String key,
                             String value)
Parameters:
key -
value -
Returns:

getAsProperties

public Properties getAsProperties(String key)

getAsProperties

public Properties getAsProperties()

getAsProperties

protected Properties getAsProperties(ConfigurationTree tree)

add

public void add(String key,
                String[] values)
Parameters:
key -
values -

add

public void add(String[] keys)
Parameters:
keys -

add

public void add(String[] treePath,
                Collection<String> values)
Parameters:
treePath -
values -

add

public ConfigurationTree add(String[] treePath,
                             String value)
Parameters:
treePath -
value -
Returns:

add

public void add(String[] treePath,
                String[] values)
Parameters:
treePath -
values -

add

public void add(Properties props)

addTreePath

protected ConfigurationTree addTreePath(Collection<String> treePath)
Parameters:
treePath -
Returns:

clear

public void clear()

containsKey

public boolean containsKey(String o)
Parameters:
o -
Returns:

containsValue

public boolean containsValue(String value)
Parameters:
value -
Returns:

getPath

protected String[] getPath(String key)

getProperty

public String getProperty(String key,
                          String def)

getProperty

public String getProperty(String key)
Parameters:
key -
Returns:

getProperty

public String getProperty(String[] keys,
                          String def)

getProperty

public String getProperty(String[] keys)

getPropertyNames

public String[] getPropertyNames()
Returns:

getPropertyNames

public String[] getPropertyNames(Collection<String> treePath)
Parameters:
treePath -
Returns:

getPropertyNames

public String[] getPropertyNames(String key)
Parameters:
key -
Returns:

getPropertyNames

public String[] getPropertyNames(String[] treePath)
Parameters:
treePath -
Returns:

getTree

public ConfigurationTree getTree(Collection<String> treePath)
Parameters:
treePath -
Returns:

getTree

public ConfigurationTree getTree(String key)
Parameters:
key -
Returns:

getTree

public ConfigurationTree getTree(String[] treePath)
Parameters:
treePath -
Returns:

getTreePath

protected ConfigurationTree getTreePath(Collection<String> treePath)
Parameters:
treePath -
Returns:

isEmpty

public boolean isEmpty()
Returns:

listPropertyNames

public Collection<String> listPropertyNames()
Returns:

purgeValue

protected Collection<String> purgeValue(Collection<String> l)

listPropertyNames

public Collection<String> listPropertyNames(Collection<String> treePath)
Parameters:
treePath -
Returns:

listPropertyNames

public Collection<String> listPropertyNames(String key)
Parameters:
key -
Returns:

listPropertyNames

public Collection<String> listPropertyNames(String[] treePath)
Parameters:
treePath -
Returns:

put

public String put(String key,
                  String value)
Parameters:
key -
value -
Returns:

remove

public String remove(String key)
Parameters:
key -
Returns:

replace

public void replace(String currentKey,
                    String newKey)
Parameters:
currentKey -
newKey -

search

public ConfigurationTree search(String key)
Parameters:
key -
Returns:

setProperty

public void setProperty(Collection<String> values)
Parameters:
values -

setProperty

public void setProperty(Collection<String> treePath,
                        Collection<String> values)
Parameters:
treePath -
values -

setProperty

public void setProperty(Collection<String> treePath,
                        String[] values)
Parameters:
treePath -
values -

setProperty

public void setProperty(String key,
                        Collection<String> values)
Parameters:
key -
values -

setProperty

public void setProperty(String key,
                        ConfigurationTree t)
Parameters:
key -
t -

setProperty

public void setProperty(String key,
                        String value)
Parameters:
key -
value -

setProperty

public void setProperty(String key,
                        String[] values)
Parameters:
key -
values -

setProperty

public void setProperty(String[] treePath,
                        Collection<String> values)
Parameters:
treePath -
values -

setProperty

public void setProperty(String[] treePath,
                        String[] values)
Parameters:
treePath -
values -

size

public int size()
Returns:

traverse

public void traverse(HashTreeTraverser<String> visitor)
Parameters:
visitor -

clone

protected Object clone()
                throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

getSpaces

protected void getSpaces(int level,
                         Writer buf)
                  throws IOException
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object

isLeaf

protected boolean isLeaf(String key)

getValue

public String getValue()
Returns:
Returns the value.

getValueOr

public String getValueOr(String def)
Get the value or return the given default value if null

Parameters:
def -
Returns:

getValue

public String getValue(String name)

getValue

public String getValue(String key,
                       String def)

setValue

public void setValue(String value)
Parameters:
value - The value to set.

setValue

public void setValue(String name,
                     String value)

Coinjema
1.7

Public Domain Software.