|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectat.knowcenter.wag.egov.egiz.cfg.PropertyTree
public class PropertyTree
This class can be used to store a property config tree. The property key are separated by the
SPLIT_STRING. Therefore the keys an also
the values of a configuration is stored in nested hashes. The keys in an area are stored in a
HashMap. The values of a key are stored in a Vector to overload some keys. The property tree can
be used to extract sub nodes and sub keys of different tree levels.
HashMap,
Vector,
Serialized Form| Field Summary | |
|---|---|
static String |
SPLIT_STRING
The key split string. |
| Constructor Summary | |
|---|---|
PropertyTree()
The default constructor od the class. |
|
| Method Summary | |
|---|---|
boolean |
containsNode(String key)
This method checks if a key is a reference to a sub tree in the current node. |
String |
getFirstValue(String key)
Returns the first value (keys can be overloaded) of a key. |
Map |
getKeyEntries()
This method return all keys (sub tree references) of the current node as a Map. |
ArrayList |
getKeys()
This method return all keys (sub tree references) of the current node as an ArrayList. |
ArrayList |
getKeys(String key)
This method return all sub tree references of a key as an ArrayList. |
String |
getLastValue(String key)
Returns the last value (keys can be overloaded) of a key. |
PropertyTree |
getSubTree(String key)
Extracts a sub tree of a nested key. |
Vector |
getValues()
This method return all values of the current node. |
Vector |
getValues(String key)
This method return all values of a key. |
void |
setKeyValue(String splitKey,
String value)
This method takes a key value tupel and store them in the property tree. |
String |
toString()
The default toString method. |
static String |
toString(String prefix,
PropertyTree tree)
The toString method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String SPLIT_STRING
| Constructor Detail |
|---|
public PropertyTree()
| Method Detail |
|---|
public void setKeyValue(String splitKey,
String value)
SPLIT_STRING). All subnodes not stored in
the tree will be created. The last part of the key (last splitted element) adds the value to
there own value data structure (Vector). setKeyValue("key.1_level.2_level","the value for k_1_2")
splitKey - the key that has to be store the valuevalue - only String values can be storedpublic String getLastValue(String key)
null.
key - the key that holds the value (can be a nested key like "key.1.2.3")
null otherwisepublic String getFirstValue(String key)
null.
key - the key that holds the value (can be a nested key like "key.1.2.3")
null otherwisepublic Vector getValues()
Vectorpublic Map getKeyEntries()
Mappublic ArrayList getKeys()
ArrayListpublic ArrayList getKeys(String key)
key - (can be a nested key like "key.1.2.3")
ArrayListpublic Vector getValues(String key)
key - (can be a nested key like "key.1.2.3")
null if the key is not in the sub
tree of the current nodeVectorpublic PropertyTree getSubTree(String key)
key.1.2.3 the sub tree of the last
node 3 is returned.
key - the reference of the sub tree
null if the key can not be foundpublic boolean containsNode(String key)
key - a simple key that is a parent reference of a sub tree
public String toString()
toString in class Object
public static String toString(String prefix,
PropertyTree tree)
prefix - the prefix for this nodetree - the current node
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||