public class PropertiesService extends Object
| Constructor and Description |
|---|
PropertiesService(String strRootPath)
Constructor should define the base root path for properties files
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertiesDirectory(String strRelativePath)
Add properties from all files found in a given directory
|
void |
addPropertiesFile(String strRelativePath,
String strFilename)
Add properties from a properties file
|
Properties |
getProperties()
Gets properties
|
String |
getProperty(String strProperty)
Returns the value of a variable defined in the .properties file of the application as a String
|
String |
getProperty(String strProperty,
String strDefault)
Returns the value of a variable defined in the .properties file of the application as a String
|
boolean |
getPropertyBoolean(String strProperty,
boolean bDefault)
Returns the value of a variable defined in the .properties file of the application as an boolean
|
int |
getPropertyInt(String strProperty,
int nDefault)
Returns the value of a variable defined in the .properties file of the application as an int
|
long |
getPropertyLong(String strProperty,
long lDefault)
Returns the value of a variable defined in the .properties file of the application as an long
|
void |
reload(String strFilename)
Reload a properties file .
|
void |
reloadAll()
Reload all properties files
|
public PropertiesService(String strRootPath)
strRootPath - The root pathpublic void addPropertiesFile(String strRelativePath, String strFilename) throws FileNotFoundException, IOException
strRelativePath - Relative path from the root pathstrFilename - The filename of the properties file (ie: config.properties)FileNotFoundException - If the file is not foundIOException - If an error occurs reading the filepublic void addPropertiesDirectory(String strRelativePath) throws IOException
strRelativePath - Relative path from the root pathIOException - If an error occurs reading the filepublic void reload(String strFilename) throws IOException
strFilename - The filename of the properties fileIOException - If an error occurs reading the filepublic void reloadAll()
throws IOException
IOException - If an error occurs reading the filepublic String getProperty(String strProperty)
strProperty - The variable namepublic String getProperty(String strProperty, String strDefault)
strProperty - The variable namestrDefault - The default value which is returned if no value is found for the variable in the .properties
file.public int getPropertyInt(String strProperty, int nDefault)
strProperty - The variable namenDefault - The default value which is returned if no value is found for the variable in the
.properties file, or if the value is not numericpublic long getPropertyLong(String strProperty, long lDefault)
strProperty - The variable namelDefault - The default value which is returned if no value is found for the variable in the le downloadFile
.properties. .properties file.public boolean getPropertyBoolean(String strProperty, boolean bDefault)
strProperty - The variable namebDefault - The default value which is returned if no value is found for the variable in the le downloadFile
.properties. .properties file.public Properties getProperties()
Copyright © 2016 City of Paris. All rights reserved.