public class PropertiesManager
extends java.util.Properties
| Constructor and Description |
|---|
PropertiesManager()
Create an unloaded Properties object.
|
PropertiesManager(java.lang.String propsFileName)
Create and load this Properties hash map from the given Properties file or properties resource located in
the jar.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getProp(java.lang.String property,
java.lang.String defaultValue)
Retrieves the property value from this object's property file.
|
boolean |
getPropAsBoolean(java.lang.String property,
java.lang.String defaultValue)
Same as the
getProp(String,String) method only it returns it's parameter as a boolean. |
int |
getPropAsInt(java.lang.String property,
java.lang.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(java.lang.String propsFilePath)
Writes the properties to the given file path.
|
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNamesclear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, size, toString, valuespublic PropertiesManager()
public PropertiesManager(java.lang.String propsFileName)
throws java.io.IOException
propsFileName - The name of the Properties file to load or URL to the properties location inside
a jarjava.io.IOException - If unable to load the properties.public void loadPropertiesFile()
throws java.io.IOException
java.io.IOException - If errorpublic void writePropsFile()
throws java.io.IOException
java.io.IOException - If error in input/outputpublic void writePropsFile(java.lang.String propsFilePath)
throws java.io.IOException
propsFilePath - The full path to the props file to be written.java.io.IOException - If error in input/outputpublic java.lang.String getProp(java.lang.String property,
java.lang.String defaultValue)
throws java.lang.Exception
property - The property sting to retrievedefaultValue - The default value for this property, if none is foundjava.lang.Exception - If errorpublic int getPropAsInt(java.lang.String property,
java.lang.String defaultValue)
throws java.lang.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 foundjava.lang.Exception - If errorpublic boolean getPropAsBoolean(java.lang.String property,
java.lang.String defaultValue)
throws java.lang.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 foundjava.lang.Exception - If error