|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Dictionary | +--java.util.Hashtable | +--java.util.Properties | +--com.mortbay.Util.PropertyTree
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.
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 |
public PropertyTree()
public PropertyTree(boolean trimLoadValues)
trimLoadValues
- If true, all values are trimmed during loads.public PropertyTree(java.util.Properties properties)
properties
- Method Detail |
public void load(java.io.InputStream in) throws java.io.IOException
public void load(java.util.Properties properties)
public java.lang.Object get(java.lang.Object key)
public java.lang.String getProperty(java.lang.String key)
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
public java.lang.Object setProperty(java.lang.String key, java.lang.String value)
public java.lang.Object remove(java.lang.Object key)
public void save(java.io.OutputStream out, java.lang.String header)
public PropertyTree getTree(java.lang.String key)
name
- The name of the sub nodepublic java.lang.StringBuffer getPrefix()
public java.util.Enumeration propertyNames()
public java.util.Enumeration elements()
public java.util.Enumeration getNodes()
public java.util.Enumeration getNodes(java.lang.String key)
key
- Key of the node.public java.util.Enumeration getRealNodes()
wild
- If false, only non-wild nodes are returned.public java.util.Enumeration getRealNodes(java.lang.String key)
key
- Key of the node.wild
- If false, only non-wild nodes are returned.public java.util.Vector getVector(java.lang.String key, java.lang.String separators)
key
- the Value(s) to get.separators
- String of separator charactorspublic boolean getBoolean(java.lang.String key)
public boolean getBoolean(java.lang.String key, boolean inDefault)
public java.lang.Object clone()
public static Converter getConverter()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |