|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectde.unidu.is.util.Config
A config file as an extension to PropertyMap, allowing for automatically loading from an existing file in directory conf/config (relative to a path in the system property "java.class.path") and saving in it. It is allowed that a key exists multiple times.
A property foo.bar which is already read from the
configuration file can be referenced by ${foo.bar}.
Currently, the property mind_home is set to the base directory
of the system (the directory containing the configuration directory).
| Constructor Summary | |
Config()
|
|
| Method Summary | |
static void |
add(java.io.File file)
Adds the content of the specified file to the config. |
static void |
add(java.io.Reader reader)
Adds the content of the specified reader to the config. |
static void |
add(java.net.URL url)
Adds the content of the specified URL to the config. |
static void |
clear()
|
static boolean |
containsKey(java.lang.Object key)
Tests if the config contains the specified key. |
static boolean |
containsValue(java.lang.Object value)
Tests if the config contains the specified value. |
static java.lang.Object |
get(java.lang.Object key)
Retrieves a value from the config specified by its key. |
static boolean |
getBoolean(java.lang.Object key)
Retrieves a value as a boolean from the config specified by its key. |
static double |
getDouble(java.lang.Object key)
Retrieves a value as a double from the config specified by its key. |
static int |
getInt(java.lang.Object key)
Retrieves a value as an integer from the config specified by its key. |
static long |
getLong(java.lang.Object key)
Retrieves a value as a long from the config specified by its key. |
static PropertyMap |
getMap()
Returns the complete map. |
static java.lang.String |
getString(java.lang.Object key)
Retrieves a value as a string from the config specified by its key. |
static java.lang.String |
getString(java.lang.Object key,
PropertyMap map)
Retrieves a value as a string from the config specified by its key. |
static void |
init(java.util.Map init)
Inits the configuration class, and loads all config files "conf/config" which can be found if the property map is not set yet. |
static boolean |
isEmpty()
Tests if this config is empty. |
static java.util.Set |
keySet()
Returns the keys in the config. |
static java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Adds an entry to the config. |
static void |
putAll(java.util.Map m)
Adds all entries in the specified map to the config |
static java.lang.Object |
remove(java.lang.Object key)
Removes the entry defined by the specified key. |
static void |
set(java.lang.Object key,
java.lang.String value)
Adds an entry to this config. |
static void |
setBoolean(java.lang.Object key,
boolean value)
Adds an entry as a boolean to this config. |
static void |
setDouble(java.lang.Object key,
double value)
Adds an entry as a double to this config. |
static void |
setInt(java.lang.Object key,
int value)
Adds an entry as an integer to this config. |
static void |
setLong(java.lang.Object key,
long value)
Adds an entry as a long to this config. |
static void |
setString(java.lang.Object key,
java.lang.String value)
Adds an entry as a string to this config. |
static int |
size()
Returns the number of entries in the config |
static java.util.Collection |
values()
Returns the values in the config. |
static void |
write(java.io.Writer writer)
Writes the config to the specified writer. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Config()
| Method Detail |
public static void init(java.util.Map init)
init - map with initial keyspublic static void write(java.io.Writer writer)
writer - writer for the configpublic static void clear()
public static void add(java.io.File file)
file - file to be addedpublic static void add(java.io.Reader reader)
reader - reader to be addedpublic static void add(java.net.URL url)
url - URL to be addedpublic static java.lang.Object get(java.lang.Object key)
key - key to be retrieved
public static boolean getBoolean(java.lang.Object key)
key - key to be retrieved
public static double getDouble(java.lang.Object key)
key - key to be retrieved
public static int getInt(java.lang.Object key)
key - key to be retrieved
public static long getLong(java.lang.Object key)
key - key to be retrieved
public static java.lang.String getString(java.lang.Object key)
key - key to be retrieved
public static java.lang.String getString(java.lang.Object key,
PropertyMap map)
key - key to be retrievedmap - map which is used if the key is not found in the config
public static void set(java.lang.Object key,
java.lang.String value)
key - key to be addedvalue - value to be added
public static void setBoolean(java.lang.Object key,
boolean value)
key - key to be addedvalue - value to be added
public static void setDouble(java.lang.Object key,
double value)
key - key to be addedvalue - value to be added
public static void setInt(java.lang.Object key,
int value)
key - key to be addedvalue - value to be added
public static void setLong(java.lang.Object key,
long value)
key - key to be addedvalue - value to be added
public static void setString(java.lang.Object key,
java.lang.String value)
key - key to be addedvalue - value to be added
public static java.lang.Object put(java.lang.Object key,
java.lang.Object value)
key - key to be addedvalue - value to be added
public static void putAll(java.util.Map m)
m - map which will be added to the configpublic static java.lang.Object remove(java.lang.Object key)
key - key to be removed
public static boolean containsKey(java.lang.Object key)
key - key to be tested
public static boolean containsValue(java.lang.Object value)
value - value to be tested
public static boolean isEmpty()
public static int size()
public static java.util.Set keySet()
public static java.util.Collection values()
public static PropertyMap getMap()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||