PropertyTree
An instance of the PropertyTree class represents a tree structure, in which each branch and leaf has a string key.
- The value that is associated with a branch key is itself an instance of PropertyTree.
- The value that is associated with a leaf key is a String.
Nesting is supported and sub-branches are addressed by concatenating keys with a dot ".".
In many ways, PropertyTree provides a similar interface to the familiar Hashtable class.
Differences in methods between Hashtable and PropertyTree are:
- Key values are type String not Object.
- The presence of "." in
a key implies nesting. So
put("A.B" "something")
implies a branch PropertyTree with keyA
containing a leaf with keyB
. The branchA
is automatically created if it does not exist. - The values which can be put are limited to classes PropertyTree and String.
- A
get(String key)
method is provided. You can usegetBranch(String key)
orgetString(String key)
, depending on whether the key was expected to address a branch or a leaf. - There is no
elements()
method.