|
|||||||||
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 | +--jcifs.util.PropertiesTree
This class is backwords compatible with Properties
however another dimension is added by using the customary dot '.' as
an operator to alternativly represent properties as trees. In essance
it gives meaning to the '.' used in keys of properties whereas with
traditional properties usage of the dot '.' was mearly a convention. This
allows applications to organize there data in new ways. The following
is an example of the "tagged" output from a PropertiesTree along with
traditional output from the same PropertiesTree to
it's right. PropertiesTree can load and store
both formats at runtime(e.g. load traditional and then store tagged).
#Feed Processor Config #Sun Dec 31 00:48:23 EST 2000 proxy=192.168.1.15 <net> username=joe <smb> host=doc-storage username=kelly </smb> <ftp> host=feed10.research.com </ftp> </net> |
#Feed Processor Config #Sun Dec 31 00:59:31 EST 2000 proxy=192.168.1.15 net.username=joe net.smb.host=doc-storage net.smb.username=kelly net.ftp.host=feed10.research.com |
In the above example, if getProperty( "net.ftp.username" )
was called "joe" would be returned. The get
method walks
up the tree searching for the first match. So the following:
net.ftp.username net.username usernameare basically equivalent and thus backwords compatible with java.util.Properties.
The benifit of using PropertiesTree
as opposed to Properties
is that a child property can mask a parent
property resulting in sophisticated hierarchial relationships. This is true of the net.smb.username
property.
It might also be thought of as overloading net.username
with net.smb.username
but only for the smb branch.
See the PropertiesTree document for details.
Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
Fields inherited from class java.util.Properties |
defaults |
Constructor Summary | |
PropertiesTree()
Construct an empty properties tree with no values. |
Method Summary | |
java.lang.Object |
get(java.lang.Object key)
Retrieved the property specified by the key parameter, seraching parent nodes if necessary. |
java.lang.String |
getProperty(java.lang.String key)
Retrieve a property from the tree by searching parent nodes if necessary and return the value as a String. |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Retrieve a property from the tree by searching parent nodes if necessary and return the value as a String. |
void |
list(java.io.PrintStream out)
List all properties in the traditional output format and truncated to ensure the contents fit within the display. |
void |
load(java.io.InputStream in)
Load all properties from the provided InputStream. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Put a key and value into the tree. |
void |
store(java.io.OutputStream out,
java.lang.String header)
Save this properties tree to the specified OutputStream. |
void |
store(java.io.OutputStream out,
java.lang.String header,
boolean tagged)
Write this properties tree to the specified OutputStream. |
Methods inherited from class java.util.Properties |
list, propertyNames, save, setProperty |
Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, hashCode, isEmpty, keys, keySet, putAll, rehash, remove, size, toString, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public PropertiesTree()
Method Detail |
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in class java.util.Hashtable
public java.lang.Object get(java.lang.Object key)
get
in class java.util.Hashtable
public java.lang.String getProperty(java.lang.String key)
getProperty
in class java.util.Properties
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
getProperty
in class java.util.Properties
public void list(java.io.PrintStream out)
list
in class java.util.Properties
public void store(java.io.OutputStream out, java.lang.String header)
store
in class java.util.Properties
public void store(java.io.OutputStream out, java.lang.String header, boolean tagged)
public void load(java.io.InputStream in) throws java.io.IOException
load
in class java.util.Properties
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |