|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable<Object,Object>
java.util.Properties
com.ccg.util.LookupProperties
public class LookupProperties
Version of Properties which implements a keyed lookup table.
This standard Properties class is pretty dang
handy thing. This class enhances it with the following
capabilities:
LookupKeyed object. You can then use it
directly to construct a TagLookup table for parsing various
objects directly.
Lookup/LookupKeyed objects
with this object to create a merger.
LookupKeyed,
Serialized Form| Field Summary |
|---|
| Fields inherited from class java.util.Properties |
|---|
defaults |
| Constructor Summary | |
|---|---|
LookupProperties()
Create a empty lookup table. |
|
LookupProperties(URL baseURL,
String path)
Construct and load a LookupProperties object. |
|
| Method Summary | |
|---|---|
void |
addFromCommaString(String s)
Parse a comma separated string containing KEY=VALUE pairs. |
Enumeration |
getKeys()
Get enumeration of all of the keys in the lookup table. |
String |
getString(Object key)
Fetch a String "value" associated with a "key". |
| Methods inherited from class java.util.Properties |
|---|
getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, storeToXML, storeToXML |
| Methods inherited from class java.util.Hashtable |
|---|
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.ccg.util.LookupKeyed |
|---|
get |
| Constructor Detail |
|---|
public LookupProperties()
lookup table.
This allows one to create a empty property table. You can use the
standard Properties.load(java.io.InputStream) or Hashtable.put(K, V) methods to add values to
the property table after you create it in this manner.
LookupProperties(URL,String)
public LookupProperties(URL baseURL,
String path)
LookupProperties object.
This constructor attempts to load the properties file based upon
two parameters which are passed. This constructor doesn't throw
any exceptions. If there were any problems encountered in loading
the specified property file, then all you can do is check via the
Hashtable.isEmpty() method. This means that you won't be able to
distinguish the condition when a property file is missing as to a
property file being empty.
The contents of the property file should be in the standard
form supported by Properties.load(java.io.InputStream).
The property file is searched for in the following manner:
Utility.convertRelativeURL(java.net.URL, java.lang.String). This can be handy for
loading propery files from applets (where you specify the document base as the URL parameter to this method.
Utility.getInputStream(String) for details).
base - Your "anchor" point to use if the "path" specified is relative
or omits protocol type information from the URL. If you pass
null, then an attempt will be made to load the properties
directly from the value specified in "path".path - The string that specifies the property file you want to load
(in a form recognized by Utility.getInputStream(java.lang.String)). If you pass null, then
the property file will be loaded from the URL specified by the "base" parameter.Hashtable.isEmpty(),
Utility.convertRelativeURL(java.net.URL, java.lang.String),
Utility.getInputStream(java.lang.String)| Method Detail |
|---|
public String getString(Object key)
Lookup object.
getString in interface LookupgetString in interface LookupKeyedkey - Key to use to look up object with (if you pass null, you will
get null back).
Lookuppublic Enumeration getKeys()
getKeys in interface LookupKeyedEnumeration list of all keys in the Lookup table.public void addFromCommaString(String s)
ENTRY[,ENTRY[,ENTRY...]
Each "ENTRY" must have one of the following forms to be accepted:
KEY[=VALUE]
The "KEY" field must ALWAYS be present. The values entered
into the Lookup table will be as follows:
Lookup
table as a string.
As an example, consider the URL recognized by the
URLConnection class:
"tcp:/localhost:5555/sendBufferSize=5000,tcpNoDelay,soLinger=3"
If you were to pass the file name portion of the above string
to this method, it would add three new key/value pairs to the
lookup table: "sendBufferSize" would return "5000", "tcpNoDelay"
would return Boolean.TRUE and "soLinger" would return
"3".
values - List key=value pairs separated only by commasURLConnection
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||