Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.jorphan.collections
Class ConfigurationTree  view ConfigurationTree download ConfigurationTree.java

java.lang.Object
  extended byorg.apache.jorphan.collections.ConfigurationTree
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class ConfigurationTree
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable


Field Summary
private static java.lang.String BLOCK
           
private static java.lang.String END_BLOCK
           
(package private)  ListedHashTree propTree
           
private static long serialVersionUID
           
private static java.lang.String VALUE
           
 
Constructor Summary
ConfigurationTree()
           
ConfigurationTree(ListedHashTree data)
           
ConfigurationTree(ListedHashTree data, java.lang.String value)
           
ConfigurationTree(java.io.Reader r)
           
ConfigurationTree(java.lang.String value)
           
 
Method Summary
 void add(java.util.Collection keys)
           
 void add(java.util.Collection treePath, java.util.Collection values)
           
 ConfigurationTree add(java.util.Collection treePath, java.lang.String value)
           
 void add(java.util.Collection treePath, java.lang.String[] values)
           
 void add(ConfigurationTree newTree)
           
 void add(java.util.Properties props)
           
 ConfigurationTree add(java.lang.String key)
           
 void add(java.lang.String[] keys)
           
 void add(java.lang.String[] treePath, java.util.Collection values)
           
 ConfigurationTree add(java.lang.String[] treePath, java.lang.String value)
           
 void add(java.lang.String[] treePath, java.lang.String[] values)
           
 void add(java.lang.String key, java.util.Collection values)
           
 void add(java.lang.String key, ConfigurationTree subTree)
           
 ConfigurationTree add(java.lang.String key, java.lang.String value)
           
 void add(java.lang.String key, java.lang.String[] values)
           
 ConfigurationTree addRaw(java.lang.String key)
           
 ConfigurationTree addRaw(java.lang.String key, java.lang.String value)
           
protected  ConfigurationTree addTreePath(java.util.Collection treePath)
           
 void clear()
           
protected  java.lang.Object clone()
          This method may be called to create a new copy of the Object.
 boolean containsKey(java.lang.String o)
           
 boolean containsValue(java.lang.String value)
           
private  java.lang.String[] convertArray(java.lang.Object[] vals)
           
static ConfigurationTree fromXML(java.io.Reader buf)
           
protected static boolean fromXML(java.io.Reader buf, ConfigurationTree tree, java.lang.String[] line)
           
 java.util.Properties getAsProperties()
           
protected  java.util.Properties getAsProperties(ConfigurationTree tree)
           
 java.util.Properties getAsProperties(java.lang.String key)
           
protected  java.lang.String[] getPath(java.lang.String key)
           
 java.lang.String getProperty(java.lang.String key)
           
 java.lang.String getProperty(java.lang.String[] keys)
           
 java.lang.String getProperty(java.lang.String[] keys, java.lang.String def)
           
 java.lang.String getProperty(java.lang.String key, java.lang.String def)
           
 java.lang.String[] getPropertyNames()
           
 java.lang.String[] getPropertyNames(java.util.Collection treePath)
           
 java.lang.String[] getPropertyNames(java.lang.String key)
           
 java.lang.String[] getPropertyNames(java.lang.String[] treePath)
           
protected  void getSpaces(int level, java.io.Writer buf)
           
 ConfigurationTree getTree(java.util.Collection treePath)
           
 ConfigurationTree getTree(java.lang.String key)
           
 ConfigurationTree getTree(java.lang.String[] treePath)
           
protected  ConfigurationTree getTreePath(java.util.Collection treePath)
           
 java.lang.String getValue()
           
 java.lang.String getValue(java.lang.String name)
           
 java.lang.String getValue(java.lang.String key, java.lang.String def)
           
 java.lang.String getValueOr(java.lang.String def)
          Get the value or return the given default value if null
 boolean isEmpty()
           
protected  boolean isLeaf(java.lang.String key)
           
 java.util.Collection listPropertyNames()
           
 java.util.Collection listPropertyNames(java.util.Collection treePath)
           
 java.util.Collection listPropertyNames(java.lang.String key)
           
 java.util.Collection listPropertyNames(java.lang.String[] treePath)
           
private  ConfigurationTree makeSubtree(ListedHashTree subTree)
           
 java.lang.String put(java.lang.String key, java.lang.String value)
           
 void putAll(java.util.Map map)
           
protected static java.lang.String readBlock(java.io.Reader buf)
           
protected static java.lang.String[] readLine(java.io.Reader buf, java.lang.String[] extra)
           
 java.lang.String remove(java.lang.String key)
           
 void replace(java.lang.String currentKey, java.lang.String newKey)
           
 ConfigurationTree search(java.lang.String key)
           
 void setProperty(java.util.Collection values)
           
 void setProperty(java.util.Collection treePath, java.util.Collection values)
           
 void setProperty(java.util.Collection treePath, java.lang.String[] values)
           
 void setProperty(java.lang.String[] treePath, java.util.Collection values)
           
 void setProperty(java.lang.String[] treePath, java.lang.String[] values)
           
 void setProperty(java.lang.String key, java.util.Collection values)
           
 void setProperty(java.lang.String key, ConfigurationTree t)
           
 void setProperty(java.lang.String key, java.lang.String value)
           
 void setProperty(java.lang.String key, java.lang.String[] values)
           
 void setValue(java.lang.String value)
           
 void setValue(java.lang.String name, java.lang.String value)
           
 int size()
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
protected  void toXML(ConfigurationTree tree, int level, java.io.Writer buf)
           
 void toXML(java.io.Writer buf)
           
 void traverse(HashTreeTraverser visitor)
           
protected  void writeLeafValue(java.io.Writer buf, java.lang.String entry, int level)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

VALUE

private static final java.lang.String VALUE
See Also:
Constant Field Values

BLOCK

private static final java.lang.String BLOCK
See Also:
Constant Field Values

END_BLOCK

private static final java.lang.String END_BLOCK
See Also:
Constant Field Values

propTree

ListedHashTree propTree
Constructor Detail

ConfigurationTree

public ConfigurationTree()

ConfigurationTree

public ConfigurationTree(java.io.Reader r)
                  throws java.io.IOException

ConfigurationTree

public ConfigurationTree(java.lang.String value)

ConfigurationTree

public ConfigurationTree(ListedHashTree data)

ConfigurationTree

public ConfigurationTree(ListedHashTree data,
                         java.lang.String value)
Method Detail

add

public void add(java.util.Collection keys)

add

public void add(java.util.Collection treePath,
                java.util.Collection values)

add

public ConfigurationTree add(java.util.Collection treePath,
                             java.lang.String value)

add

public void add(java.util.Collection treePath,
                java.lang.String[] values)

add

public void add(ConfigurationTree newTree)

add

public ConfigurationTree add(java.lang.String key)

addRaw

public ConfigurationTree addRaw(java.lang.String key,
                                java.lang.String value)

addRaw

public ConfigurationTree addRaw(java.lang.String key)

add

public void add(java.lang.String key,
                java.util.Collection values)

add

public void add(java.lang.String key,
                ConfigurationTree subTree)

add

public ConfigurationTree add(java.lang.String key,
                             java.lang.String value)

getAsProperties

public java.util.Properties getAsProperties(java.lang.String key)

getAsProperties

public java.util.Properties getAsProperties()

getAsProperties

protected java.util.Properties getAsProperties(ConfigurationTree tree)

add

public void add(java.lang.String key,
                java.lang.String[] values)

add

public void add(java.lang.String[] keys)

add

public void add(java.lang.String[] treePath,
                java.util.Collection values)

add

public ConfigurationTree add(java.lang.String[] treePath,
                             java.lang.String value)

add

public void add(java.lang.String[] treePath,
                java.lang.String[] values)

add

public void add(java.util.Properties props)

addTreePath

protected ConfigurationTree addTreePath(java.util.Collection treePath)

clear

public void clear()

containsKey

public boolean containsKey(java.lang.String o)

containsValue

public boolean containsValue(java.lang.String value)

getPath

protected java.lang.String[] getPath(java.lang.String key)

getProperty

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

getProperty

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

getProperty

public java.lang.String getProperty(java.lang.String[] keys,
                                    java.lang.String def)

getProperty

public java.lang.String getProperty(java.lang.String[] keys)

getPropertyNames

public java.lang.String[] getPropertyNames()

convertArray

private java.lang.String[] convertArray(java.lang.Object[] vals)

getPropertyNames

public java.lang.String[] getPropertyNames(java.util.Collection treePath)

getPropertyNames

public java.lang.String[] getPropertyNames(java.lang.String key)

getPropertyNames

public java.lang.String[] getPropertyNames(java.lang.String[] treePath)

getTree

public ConfigurationTree getTree(java.util.Collection treePath)

getTree

public ConfigurationTree getTree(java.lang.String key)

getTree

public ConfigurationTree getTree(java.lang.String[] treePath)

makeSubtree

private ConfigurationTree makeSubtree(ListedHashTree subTree)

getTreePath

protected ConfigurationTree getTreePath(java.util.Collection treePath)

isEmpty

public boolean isEmpty()

listPropertyNames

public java.util.Collection listPropertyNames()

listPropertyNames

public java.util.Collection listPropertyNames(java.util.Collection treePath)

listPropertyNames

public java.util.Collection listPropertyNames(java.lang.String key)

listPropertyNames

public java.util.Collection listPropertyNames(java.lang.String[] treePath)

put

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

putAll

public void putAll(java.util.Map map)

remove

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

replace

public void replace(java.lang.String currentKey,
                    java.lang.String newKey)

search

public ConfigurationTree search(java.lang.String key)

setProperty

public void setProperty(java.util.Collection values)

setProperty

public void setProperty(java.util.Collection treePath,
                        java.util.Collection values)

setProperty

public void setProperty(java.util.Collection treePath,
                        java.lang.String[] values)

setProperty

public void setProperty(java.lang.String key,
                        java.util.Collection values)

setProperty

public void setProperty(java.lang.String key,
                        ConfigurationTree t)

setProperty

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

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String[] values)

setProperty

public void setProperty(java.lang.String[] treePath,
                        java.util.Collection values)

setProperty

public void setProperty(java.lang.String[] treePath,
                        java.lang.String[] values)

size

public int size()

traverse

public void traverse(HashTreeTraverser visitor)

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
Description copied from class: java.lang.Object
This method may be called to create a new copy of the Object. The typical behavior is as follows:
  • o == o.clone() is false
  • o.getClass() == o.clone().getClass() is true
  • o.equals(o) is true

However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>Object.equals(Object) 55 .

If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.

Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.

All array types implement Cloneable, and override this method as follows (it should never fail):

 public Object clone()
 {
   try
     {
       super.clone();
     }
   catch (CloneNotSupportedException e)
     {
       throw new InternalError(e.getMessage());
     }
 }
 


getSpaces

protected void getSpaces(int level,
                         java.io.Writer buf)
                  throws java.io.IOException

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


fromXML

public static ConfigurationTree fromXML(java.io.Reader buf)
                                 throws java.io.IOException

fromXML

protected static boolean fromXML(java.io.Reader buf,
                                 ConfigurationTree tree,
                                 java.lang.String[] line)
                          throws java.io.IOException

readLine

protected static java.lang.String[] readLine(java.io.Reader buf,
                                             java.lang.String[] extra)
                                      throws java.io.IOException

readBlock

protected static java.lang.String readBlock(java.io.Reader buf)
                                     throws java.io.IOException

toXML

public void toXML(java.io.Writer buf)
           throws java.io.IOException

isLeaf

protected boolean isLeaf(java.lang.String key)

toXML

protected void toXML(ConfigurationTree tree,
                     int level,
                     java.io.Writer buf)
              throws java.io.IOException

writeLeafValue

protected void writeLeafValue(java.io.Writer buf,
                              java.lang.String entry,
                              int level)
                       throws java.io.IOException

getValue

public java.lang.String getValue()

getValueOr

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


getValue

public java.lang.String getValue(java.lang.String name)

getValue

public java.lang.String getValue(java.lang.String key,
                                 java.lang.String def)

setValue

public void setValue(java.lang.String value)

setValue

public void setValue(java.lang.String name,
                     java.lang.String value)