|
||||||||||
| 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
info.informatica.util.EnvironProperties
public class EnvironProperties
Properties with variable substitution.
With this variant of Properties, you can do things like the following:
name=myname
path=/path/to/${name}
| Constructor Summary | |
|---|---|
EnvironProperties()
Creates an empty environ list with no default values. |
|
EnvironProperties(Properties defaults)
Creates an empty environ list with the specified defaults. |
|
| Method Summary | |
|---|---|
String |
getProperty(String key)
Gets a property attempting environment-variable style substitution. |
String |
getUnparsedProperty(String key)
Searches for the property with the specified key in this property list. |
String |
parse(String line)
Attempts to parse the contents of a line and perform a variable substitution when an environ-style entry ( ${property-key})
is found. |
void |
setKeyPrefix(String prefix)
Set a key prefix to be prepended to all keys used. |
void |
setParse(boolean doparsing)
Turns on/off parsing when calling getProperty method. |
void |
setRecursionLevel(int max)
Sets the maximum recursion level in case there is a loop in property evaluations (for example a=${b}, b=${a}). |
| Methods inherited from class java.util.Properties |
|---|
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, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public EnvironProperties()
public EnvironProperties(Properties defaults)
defaults - the defaults.| Method Detail |
|---|
public void setRecursionLevel(int max)
a=${b}, b=${a}).
The default value will work for most cases.
max - the maximum recursion level.
public String parse(String line)
throws ParsingException
${property-key})
is found.
Any occurrence of ${property-key} is replaced by the value
of that property key.
In order to avoid possible infinite loops, while property evaluation is
recursive, loops are limited to what is set by
setRecursionLevel. Default value should be appropriate
for most uses.
line - the line to be parsed.
ParsingException - if a syntax error is found.public void setParse(boolean doparsing)
doparsing - true to activate parsing, false to deactivate.public String getProperty(String key)
${property-key} in the key
property value is, in turn, replaced by the value of that property-key.
If a parsing error occurs, returns the unparsed value.
Property evaluation is recursive.
getProperty in class Propertieskey - the property key.
public String getUnparsedProperty(String key)
Does not attempt to do any variable substitution.
key - the property key.
public void setKeyPrefix(String prefix)
For example, if a "myapp" prefix is set, and the property file looks like:
myapp.key1=value1 myapp.key2=value2 myapp.otherkey=othervalueThen getting, for example, the "key1" property will return "value1".
This is useful when you want to keep several property sets in a single file.
prefix - the prefix to be prepended (together with a dot). If null, no
prefix will be used.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||