|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--jstorm.util.PropertyLoader
Very useful class for loading and accessing application level properties.
PropertyLoader
will load properties from a file in the CLASSPATH using a java.util.ResourceBundle.
The name of the property file can be specified with a system property, for example:
java -D lante.properties.file=test ClassName
The '-D' flag loads a value into the System Properties, in this case the value test is being loaded with the key lante.properties.file.
In this example, PropertyLoader will look for a file called test.properties.
| Field Summary | |
static java.util.ResourceBundle |
bundle
|
| Constructor Summary | |
PropertyLoader()
|
|
| Method Summary | |
static boolean |
getBooleanProperty(java.lang.String key,
boolean defaultValue)
Converts the String value into a boolean type. |
static java.lang.Class |
getClassProperty(java.lang.String key,
java.lang.Class defaultValue)
Converts the String value into a Class using Class.forName(). |
static float |
getFloatProperty(java.lang.String key,
float defaultValue)
Convert the string property value into a Float. |
static int |
getIntProperty(java.lang.String key,
int defaultValue)
Convert the string property value into a int. |
static long |
getLongProperty(java.lang.String key,
long defaultValue)
Convert the string property value into a long. |
static java.lang.String |
getProperty(java.lang.String key)
Get a property, returns null if the property is not found. WARNING: Please use the methods with default values to ensure that a non null value is returned. |
static java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Get a string property. |
static java.util.Enumeration |
getPropertyNames()
Returns an enumeration of all the key values in this ProperyLoader |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static java.util.ResourceBundle bundle
| Constructor Detail |
public PropertyLoader()
| Method Detail |
public static boolean getBooleanProperty(java.lang.String key,
boolean defaultValue)
String value into a boolean type. Returns default if the
property does not exist.
public static java.lang.Class getClassProperty(java.lang.String key,
java.lang.Class defaultValue)
String value into a Class using Class.forName().
Returns the defualt value if the property can't be found or the value can't be converted into a
Class.
public static float getFloatProperty(java.lang.String key,
float defaultValue)
Float. Returns the default value if the property
is not found or if there is a problem converting the value to a Float.
public static int getIntProperty(java.lang.String key,
int defaultValue)
int. Returns the default value if the property
is not found or if there is a problem converting the value to a int.
public static long getLongProperty(java.lang.String key,
long defaultValue)
long. Returns the default value if the property
is not found or if there is a problem converting the value to a long.public static java.lang.String getProperty(java.lang.String key)
public static java.lang.String getProperty(java.lang.String key,
java.lang.String defaultValue)
public static java.util.Enumeration getPropertyNames()
ProperyLoader
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||