|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Dictionary<K,V> java.util.Hashtable<java.lang.Object,java.lang.Object> java.util.Properties org.knowceans.util.Conf
public class Conf
Reads configuration information from a properties file. Implemented as singleton.
The file is looked up according to the following priorities list:
This version allows the definition of variables that can be expanded at readtime:
Constructor Summary | |
---|---|
Conf(java.lang.String file)
|
Method Summary | |
---|---|
static boolean |
exists()
Allows to check if a configuration has been loaded from a file already (to reduce dynamic loading overhead). |
static Conf |
get()
get the instance of the singleton object |
static java.lang.String |
get(java.lang.String key)
get the named property from the singleton object |
static java.lang.String |
getBasePath()
|
static boolean |
getBoolean(java.lang.String key)
get a boolean value: true and 1 are allowed for true, anything else for false |
static java.lang.Class |
getClass(java.lang.String clazz)
Get class with the name specified by the property, using the default class loader. |
static double |
getDouble(java.lang.String key)
get a numeric value. |
static double[] |
getDoubleArray(java.lang.String key)
Get a double array from the file, where the vales are separated by comma, semicolon or space. |
static float |
getFloat(java.lang.String key)
|
static java.lang.Object |
getInstance(java.lang.String clazz)
Get an instance of the class that corresponds to the property name and has a default constructor. |
static int |
getInt(java.lang.String key)
Get an integer value. |
static int[] |
getIntArray(java.lang.String key)
Get an integer array from the file, where the vales are separated by comma, semicolon or space. |
static long |
getLong(java.lang.String key)
get a numeric value. |
static java.lang.String |
getOverridePropFile()
get the overridden properties file. |
static java.lang.String |
getPropFile()
|
static boolean |
load(java.lang.String file)
Instantiate the configuration, e.g., in the main class. |
static void |
main(java.lang.String[] args)
|
static void |
overridePropFile(java.lang.String string)
override the default properties file locations. |
static void |
setBasePath(java.lang.String string)
|
static void |
setPropFile(java.lang.String string)
|
Methods inherited from class java.util.Properties |
---|
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames |
Methods inherited from class java.util.Hashtable |
---|
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, remove, size, toString, values |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Conf(java.lang.String file)
Method Detail |
---|
public static Conf get()
public static boolean exists()
public static boolean load(java.lang.String file)
file
-
public static java.lang.String get(java.lang.String key)
public static double getDouble(java.lang.String key)
key
-
public static float getFloat(java.lang.String key)
public static long getLong(java.lang.String key)
key
-
public static int getInt(java.lang.String key)
key
-
public static double[] getDoubleArray(java.lang.String key)
key
-
public static int[] getIntArray(java.lang.String key)
key
-
public static boolean getBoolean(java.lang.String key)
key
-
public static java.lang.Object getInstance(java.lang.String clazz) throws java.lang.Exception
clazz
-
java.lang.Exception
public static java.lang.Class getClass(java.lang.String clazz) throws java.lang.ClassNotFoundException
clazz
-
java.lang.ClassNotFoundException
public static java.lang.String getBasePath()
public static java.lang.String getPropFile()
public static void setBasePath(java.lang.String string)
string
- public static void setPropFile(java.lang.String string)
string
- public static java.lang.String getOverridePropFile()
public static void overridePropFile(java.lang.String string)
string
- public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |