org.apache.jorphan.collections
Class ConfigurationTree
java.lang.Object
org.apache.jorphan.collections.ConfigurationTree
- All Implemented Interfaces:
- Cloneable, Serializable
- public class ConfigurationTree
- extends Object
- implements Serializable, Cloneable
- Author:
- mike
- See Also:
- Serialized Form
Method Summary |
void |
add(Collection keys)
|
void |
add(Collection treePath,
Collection values)
|
ConfigurationTree |
add(Collection treePath,
String value)
|
void |
add(Collection treePath,
String[] values)
|
void |
add(ConfigurationTree newTree)
|
void |
add(Properties props)
|
ConfigurationTree |
add(String key)
|
void |
add(String[] keys)
|
void |
add(String[] treePath,
Collection values)
|
ConfigurationTree |
add(String[] treePath,
String value)
|
void |
add(String[] treePath,
String[] values)
|
void |
add(String key,
Collection 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 treePath)
|
void |
clear()
|
protected Object |
clone()
|
boolean |
containsKey(String o)
|
boolean |
containsValue(String value)
|
static ConfigurationTree |
fromXML(Reader buf)
|
protected static boolean |
fromXML(Reader buf,
ConfigurationTree tree,
String[] line)
|
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 treePath)
|
String[] |
getPropertyNames(String key)
|
String[] |
getPropertyNames(String[] treePath)
|
protected void |
getSpaces(int level,
Writer buf)
|
ConfigurationTree |
getTree(Collection treePath)
|
ConfigurationTree |
getTree(String key)
|
ConfigurationTree |
getTree(String[] treePath)
|
protected ConfigurationTree |
getTreePath(Collection 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 |
listPropertyNames()
|
Collection |
listPropertyNames(Collection treePath)
|
Collection |
listPropertyNames(String key)
|
Collection |
listPropertyNames(String[] treePath)
|
String |
put(String key,
String value)
|
void |
putAll(Map map)
|
protected static String |
readBlock(Reader buf)
|
protected static String[] |
readLine(Reader buf,
String[] extra)
|
String |
remove(String key)
|
void |
replace(String currentKey,
String newKey)
|
ConfigurationTree |
search(String key)
|
void |
setProperty(Collection values)
|
void |
setProperty(Collection treePath,
Collection values)
|
void |
setProperty(Collection treePath,
String[] values)
|
void |
setProperty(String[] treePath,
Collection values)
|
void |
setProperty(String[] treePath,
String[] values)
|
void |
setProperty(String key,
Collection 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()
|
protected void |
toXML(ConfigurationTree tree,
int level,
Writer buf)
|
void |
toXML(Writer buf)
|
void |
traverse(HashTreeTraverser visitor)
|
protected void |
writeLeafValue(Writer buf,
String entry,
int level)
|
ConfigurationTree
public ConfigurationTree()
ConfigurationTree
public ConfigurationTree(Reader r)
throws IOException
ConfigurationTree
public ConfigurationTree(String value)
ConfigurationTree
public ConfigurationTree(ListedHashTree data)
ConfigurationTree
public ConfigurationTree(ListedHashTree data,
String value)
add
public void add(Collection keys)
- Parameters:
keys
-
add
public void add(Collection treePath,
Collection values)
- Parameters:
treePath
- values
-
add
public ConfigurationTree add(Collection treePath,
String value)
- Parameters:
treePath
- value
-
- Returns:
add
public void add(Collection 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 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 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 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 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 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 treePath)
- Parameters:
treePath
-
- Returns:
isEmpty
public boolean isEmpty()
- Returns:
listPropertyNames
public Collection listPropertyNames()
- Returns:
listPropertyNames
public Collection listPropertyNames(Collection treePath)
- Parameters:
treePath
-
- Returns:
listPropertyNames
public Collection listPropertyNames(String key)
- Parameters:
key
-
- Returns:
listPropertyNames
public Collection listPropertyNames(String[] treePath)
- Parameters:
treePath
-
- Returns:
put
public String put(String key,
String value)
- Parameters:
key
- value
-
- Returns:
putAll
public void putAll(Map map)
- Parameters:
map
-
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 values)
- Parameters:
values
-
setProperty
public void setProperty(Collection treePath,
Collection values)
- Parameters:
treePath
- values
-
setProperty
public void setProperty(Collection treePath,
String[] values)
- Parameters:
treePath
- values
-
setProperty
public void setProperty(String key,
Collection 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 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 visitor)
- Parameters:
visitor
-
clone
protected Object clone()
throws CloneNotSupportedException
- Throws:
CloneNotSupportedException
getSpaces
protected void getSpaces(int level,
Writer buf)
throws IOException
- Throws:
IOException
toString
public String toString()
fromXML
public static ConfigurationTree fromXML(Reader buf)
throws IOException
- Throws:
IOException
fromXML
protected static boolean fromXML(Reader buf,
ConfigurationTree tree,
String[] line)
throws IOException
- Parameters:
buf
- tree
-
- Throws:
IOException
readLine
protected static String[] readLine(Reader buf,
String[] extra)
throws IOException
- Parameters:
buf
-
- Throws:
IOException
readBlock
protected static String readBlock(Reader buf)
throws IOException
- Throws:
IOException
toXML
public void toXML(Writer buf)
throws IOException
- Throws:
IOException
isLeaf
protected boolean isLeaf(String key)
toXML
protected void toXML(ConfigurationTree tree,
int level,
Writer buf)
throws IOException
- Throws:
IOException
writeLeafValue
protected void writeLeafValue(Writer buf,
String entry,
int level)
throws IOException
- Throws:
IOException
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)
Copyright © 1998-2005 Apache Software Foundation. All Rights Reserved.