|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Dictionary | +--java.util.Hashtable | +--java.util.Properties | +--org.jlf.util.AppProperties
AppProperties
provides utilities to access property files.
It is both a concrete class to retrieve property file settings from
the main property file, but also an extensible class for getting settings
from your own property file (subclass it, create your own singleton,
and change the property file name).
Properties
,
Serialized FormField Summary | |
protected static java.lang.String |
PROPERTY_FILE_COMPONENT_VERSION_PREFIX
The prefix in the property file for all component versions. |
protected java.lang.String |
propertyFileName
Holds the file name of the property file. |
protected static AppProperties |
singleton
Provides the class variable for the Singleton pattern, to keep track of the one and only instance of this class. |
Fields inherited from class java.util.Properties |
defaults |
Constructor Summary | |
protected |
AppProperties()
Protect the default constructor, this class uses a Singleton pattern. |
|
AppProperties(java.util.Properties properties)
Constructor which populates the current object with the properties give. |
|
AppProperties(java.lang.String propertyFileName)
Constructor which reads the property file with the file name given. |
Method Summary | |
boolean |
getBooleanProperty(java.lang.String propertyName,
boolean defaultValue)
Get value of a global property (inside system.properties) and return it as an boolean type. |
java.util.Properties |
getComponentsAndVersions()
Returns a Hashtable containing all of the
component names found in the property file (designated by
a property file prefix in PROPERTY_FILE_COMPONENT_VERSION_PREFIX). |
static AppProperties |
getInstance()
Returns the singleton instance of this class. |
int |
getIntegerProperty(java.lang.String propertyName,
int defaultValue)
Get value of a property as an int type. |
long |
getLongProperty(java.lang.String propertyName,
long defaultValue)
Get value of a global property (inside system.properties) and return it as an int type. |
java.util.Properties |
getPropertiesForPrefix(java.lang.String prefix)
Returns a Properties object containing all of the
property names found in the property file (designated by
a property file prefix taken from the prefix input variable). |
java.lang.String |
getStringProperty(java.lang.String propertyName,
java.lang.String defaultValue)
Get value of a global property (inside system.properties) and return it as a String type. |
protected boolean |
isRelativePathFileName(java.lang.String fileName)
Helper method to find if a file name has slashes/backslashes in it. |
protected void |
load(java.lang.String fileName)
This method loads properties from the file name given as input. |
Methods inherited from class java.util.Properties |
getProperty, getProperty, list, list, load, propertyNames, save, setProperty, store |
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 |
Field Detail |
protected static AppProperties singleton
protected static final java.lang.String PROPERTY_FILE_COMPONENT_VERSION_PREFIX
protected java.lang.String propertyFileName
Constructor Detail |
protected AppProperties()
public AppProperties(java.lang.String propertyFileName)
public AppProperties(java.util.Properties properties)
Method Detail |
public static AppProperties getInstance()
protected boolean isRelativePathFileName(java.lang.String fileName)
protected void load(java.lang.String fileName)
public int getIntegerProperty(java.lang.String propertyName, int defaultValue)
propertyName
- The name of the propertydefaultValue
- If not found or cannot be decoded, return
this value
public long getLongProperty(java.lang.String propertyName, long defaultValue)
propertyName
- The name of the propertydefaultValue
- If not found or cannot be decoded, return
this value
public boolean getBooleanProperty(java.lang.String propertyName, boolean defaultValue)
propertyName
- The name of the propertydefaultValue
- If not found or cannot be decoded, return
this value
public java.lang.String getStringProperty(java.lang.String propertyName, java.lang.String defaultValue)
propertyName
- The name of the propertydefaultValue
- If not found or cannot be decoded, return
this value
public java.util.Properties getPropertiesForPrefix(java.lang.String prefix)
Properties
object containing all of the
property names found in the property file (designated by
a property file prefix taken from the prefix input variable).
The key to the properties is the property name portion after the
prefix and the
value in the properties is its property file value.
public java.util.Properties getComponentsAndVersions()
Hashtable
containing all of the
component names found in the property file (designated by
a property file prefix in PROPERTY_FILE_COMPONENT_VERSION_PREFIX).
The key to the Hashtable is the component name and the
value is the revision level.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |