|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.ObjectConfigMgr
A class to parse and store the config hash table. Handles comments with '#' as the first char, empty lines, and values that "have spaces and are in quotes". TODO: Revamp to use getBool/getString/getInt
| Field Summary | |
private Hashtable |
config
This stores the key-value pairs that make up the ConfigMgr. |
private String |
configfile
The filename of the file to read the runtime configuration data from. |
| Constructor Summary | |
ConfigMgr(String filename)
Construct the class by saving the param and parsing the config file. |
|
| Method Summary | |
Object |
get(String key)
Retrieve a value given its key. |
Boolean |
getBool(String key)
Retrieves the value of the key from the configuration, then attempts to parse boolean data from it. |
Integer |
getInt(String key)
Retrieves the value of the key from the configuration, then attempts to parse integer data from it. |
String |
getString(String key)
Retrieves the value of the given key from the configuration and then attempts to cast it to a String object. |
private void |
loadConfig(String filename)
A helper method to parse and store the config. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private String configfile
private Hashtable config
| Constructor Detail |
public ConfigMgr(String filename)
filename - The name of the file that contains the config options.| Method Detail |
private void loadConfig(String filename)
filename - The name of the file to parse and store.public Object get(String key)
key - The key of the value to get.public Integer getInt(String key)
key - The key of the value to retrieve.public Boolean getBool(String key)
key - The key of the value to retreive.public String getString(String key)
key - The key of the value to retreive.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||