|
||||||||||
| 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<java.lang.Object,java.lang.Object>
java.util.Properties
net.spy.util.SpyConfig
public class SpyConfig
SpyConfig - an abstracted config file maintainer. The current config file format is that of a java Properties file. This class makes it easier to load them, caches them, and gives a good base for extensions that load default config files for projects that are hard to pass config filepaths into.
| Field Summary |
|---|
| Fields inherited from class java.util.Properties |
|---|
defaults |
| Constructor Summary | |
|---|---|
SpyConfig()
Construct a new SpyConfig object without a config file. |
|
SpyConfig(java.io.File conffile)
Construct a new SpyConfig object describing a config file. |
|
| Method Summary | |
|---|---|
java.lang.String |
get(java.lang.String key)
Get the value for a given config entry. |
java.lang.String |
get(java.lang.String key,
java.lang.String def)
Get the value for a given config entry, with default. |
int |
getInt(java.lang.String key,
int def)
Get an int value for a given config entry. |
boolean |
loadConfig(java.io.File conffile)
Try to load a config file. |
boolean |
loadConfig(java.io.File[] confFiles)
Try to load a config file. |
void |
orput(java.lang.String key,
java.lang.String value)
Assign a value to the config only if it doesn't already exist. |
| 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 |
| Constructor Detail |
|---|
public SpyConfig(java.io.File conffile)
conffile - The config file we are describing.public SpyConfig()
| Method Detail |
|---|
public boolean loadConfig(java.io.File conffile)
conffile - Path to the configuration file to load.
public boolean loadConfig(java.io.File[] confFiles)
confFiles - an array of config file paths to attempt to load
public java.lang.String get(java.lang.String key)
key - which config entry to return.
public java.lang.String get(java.lang.String key,
java.lang.String def)
key - which config entry to return.def - default in case the entry doesn't exist.
public int getInt(java.lang.String key,
int def)
key - which config entry to return.def - default in case the entry doesn't exist.
public void orput(java.lang.String key,
java.lang.String value)
key - config keyvalue - config value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||