|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Observable
lazyj.ExtProperties
public final class ExtProperties
Utility class to process enhanced .properties file.
Such a file can have a special "include" key, which is a list of comma-separated file names
(without the .properties extension) relative to the same base folder.
Each value can contain constructions like:
${other_key} , to include the value of another key in that place
| Constructor Summary | |
|---|---|
ExtProperties()
Default constructor, creates a configuration dictionary that has no file backing. |
|
ExtProperties(java.io.InputStream is)
Load the configuration from an InputStream (such as the one returned by ClassLoader.getResourceAsStream(String) |
|
ExtProperties(java.util.Properties inherit)
Copy constructor |
|
ExtProperties(java.lang.String sBaseConfigDir,
java.lang.String sConfigFilename)
Load the contents of a .properties file from the sConfDir path. |
|
ExtProperties(java.lang.String sBaseConfigDir,
java.lang.String sConfigFilename,
ExtProperties superProperties)
Load the contents of a .properties file from the sConfDir path. |
|
| Method Summary | |
|---|---|
void |
clearCache()
Method to clear the cache in order to force the evaluation of the keys once again. |
boolean |
getb(java.lang.String sKey,
boolean bDefault)
Parse an option to return the boolean value. |
java.lang.String |
getConfigFileName()
Get the name of the file that was loaded. |
double |
getd(java.lang.String sKey,
double dDefault)
Get the double value for a key. |
int |
geti(java.lang.String sKey,
int iDefault)
Get the integer value for a key. |
long |
getl(java.lang.String sKey,
long lDefault)
Get the long value for a key. |
java.util.Properties |
getProperties()
Get a Properties view of this object. |
java.lang.String |
gets(java.lang.String sKey)
Get the String value for a given key. |
java.lang.String |
gets(java.lang.String sKey,
java.lang.String sDefault)
Get the String value for a given key, returning the given default value if the key is not defined. |
java.lang.String |
gets(java.lang.String sKey,
java.lang.String sDefault,
boolean bProcessQueries)
Get the String value for a given key, returning the given default value if the key is not defined. |
void |
makeReadOnly()
Make this dictionary read-only, to prevent writes from other pieces of code that see this object. |
java.lang.String |
parseOption(java.lang.String sKey,
java.lang.String sValue,
java.lang.String sDefault,
boolean bProcessQueries)
Parse a value to include other keys |
void |
reload()
Re-read the same configuration file. |
void |
set(java.lang.String sKey,
java.lang.String sValue)
Modify an entry of the dictionary. |
void |
setAutoReload(long lReload)
Make this object check for changes in the base file and reload the contents when it changes. |
java.lang.String |
toString()
Get some debugging info for this object |
java.util.Vector<java.lang.String> |
toVector(java.lang.String sKey)
Split a value by "," and return a Vector of String parts. |
void |
update(java.util.Observable o,
java.lang.Object arg)
Implementation of the Observer interface. |
| Methods inherited from class java.util.Observable |
|---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ExtProperties()
public ExtProperties(java.io.InputStream is)
throws java.io.IOException
ClassLoader.getResourceAsStream(String)
is - input stream to read from
java.io.IOException - in case of problems while reading from the stream
public ExtProperties(java.lang.String sBaseConfigDir,
java.lang.String sConfigFilename)
sBaseConfigDir - base folder for the configuration filessConfigFilename - file to load, without the ".properties" extension, that will be automatically added
public ExtProperties(java.lang.String sBaseConfigDir,
java.lang.String sConfigFilename,
ExtProperties superProperties)
sBaseConfigDir - base folder for all the configuration filessConfigFilename - file to load (without the ".properties" extension)superProperties - other configuration to use as default (the keys from the current file will override the ones given as defaults)public ExtProperties(java.util.Properties inherit)
inherit - key-value pairs to copy| Method Detail |
|---|
public void setAutoReload(long lReload)
lReload - public java.lang.String getConfigFileName()
public void reload()
public void makeReadOnly()
public java.lang.String parseOption(java.lang.String sKey,
java.lang.String sValue,
java.lang.String sDefault,
boolean bProcessQueries)
sKey - the key that is parsedsValue - original valuesDefault - default value, in case of an error in parsingbProcessQueries - whether or not to execute database queries / cache lookups
public java.lang.String gets(java.lang.String sKey)
sKey - the key to get the value for
gets(String, String, boolean)
public java.lang.String gets(java.lang.String sKey,
java.lang.String sDefault)
sKey - the key to get the value forsDefault - default value to return in case the key is not defined
gets(String, String, boolean)
public java.lang.String gets(java.lang.String sKey,
java.lang.String sDefault,
boolean bProcessQueries)
null
values are not cached.
sKey - the key to get the value forsDefault - default value to return in case the key is not defined.bProcessQueries - flag to process or not process the database/memory cache queries
public boolean getb(java.lang.String sKey,
boolean bDefault)
sKey - the key to get the value forbDefault - default value
public int geti(java.lang.String sKey,
int iDefault)
sKey - the key to get the value foriDefault - default value
public long getl(java.lang.String sKey,
long lDefault)
sKey - the key to get the value forlDefault - default value
public double getd(java.lang.String sKey,
double dDefault)
sKey - the key to get the value fordDefault - default value
public java.util.Vector<java.lang.String> toVector(java.lang.String sKey)
sKey - the key to get the values for
public void clearCache()
public java.lang.String toString()
toString in class java.lang.Object
public void set(java.lang.String sKey,
java.lang.String sValue)
sKey - key to changesValue - new valuepublic java.util.Properties getProperties()
public void update(java.util.Observable o,
java.lang.Object arg)
Observer interface. Since this object can monitor the original file
for changes, it will be notified by a call to this method when this happens.
update in interface java.util.Observero - ignoredarg - ignored
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||