|
DLESE Tools v1.6.0 |
||||||||
| 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<Object,Object>
java.util.Properties
org.dlese.dpc.propertiesmgr.PropertiesManager
public class PropertiesManager
Reads and writes Java properties files. Properties files can be on disc or contained within a Jar file.
| Field Summary |
|---|
| Fields inherited from class java.util.Properties |
|---|
defaults |
| Constructor Summary | |
|---|---|
PropertiesManager()
Create an unloaded Properties object. |
|
PropertiesManager(String propsFileName)
Create and load this Properties hash map from the given Properties file or properties resource located in the jar. |
|
| Method Summary | |
|---|---|
String |
getProp(String property,
String defaultValue)
Retrieves the property value from this object's property file. |
boolean |
getPropAsBoolean(String property,
String defaultValue)
Same as the getProp(String,String) method only it returns it's parameter as a boolean. |
int |
getPropAsInt(String property,
String defaultValue)
Same as the getProp(String,String) method only it returns it's parameter as an integer. |
void |
loadPropertiesFile()
Loads or re-loads the properties from its file or JAR, replacing all previously loaded properties, if any. |
void |
writePropsFile()
Writes the properties to the same file that was used to read them, preserving any comments in the file. |
void |
writePropsFile(String propsFilePath)
Writes the properties to the given file path. |
| 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, rehash, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PropertiesManager()
public PropertiesManager(String propsFileName)
throws IOException
propsFileName - The name of the Properties file to load or URL to the properties location inside
a jar
IOException - If unable to load the properties.| Method Detail |
|---|
public void loadPropertiesFile()
throws IOException
IOException - If error
public void writePropsFile()
throws IOException
IOException - If error in input/output
public void writePropsFile(String propsFilePath)
throws IOException
propsFilePath - The full path to the props file to be written.
IOException - If error in input/output
public String getProp(String property,
String defaultValue)
throws Exception
property - The property sting to retrievedefaultValue - The default value for this property, if none is found
Exception - If error
public int getPropAsInt(String property,
String defaultValue)
throws Exception
getProp(String,String) method only it returns it's parameter as an integer.
property - The property sting to retrievedefaultValue - The default value for this property, if none is found
Exception - If error
public boolean getPropAsBoolean(String property,
String defaultValue)
throws Exception
getProp(String,String) method only it returns it's parameter as a boolean. Possible
inputs are [yes|no|true|false|on|off|enabled|disabled].
property - The property sting to retrievedefaultValue - The default value for this property, if none is found
Exception - If error
|
DLESE Tools v1.6.0 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||