|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.core.Environment
public class Environment
This class encapsulates a map of all environment and java system properties. There are methods for adding and removing variables to this Environment object as well as to the system wide global environment. There is also a method for replacing key names (enclosed by ${}) with their associated value in Strings.
| Constructor Summary | |
|---|---|
Environment()
|
|
| Method Summary | |
|---|---|
void |
addVariable(String key,
String value)
Add a variable to the internal map of this properties object. |
void |
addVariableSystemWide(String key,
String value)
Add a a variable to the internal map of this properties object and to the global system-wide environment; |
static boolean |
containsEnvVariables(String source)
Tests for the presence of environment variables. |
String |
getRevision()
Returns the revision string. |
static Environment |
getSystemWide()
Get the singleton system-wide (visible to every class in the running VM) set of environment variables. |
Set<String> |
getVariableNames()
Get the names of the variables (keys) stored in the internal map. |
String |
getVariableValue(String key)
Get the value for a particular variable. |
static void |
main(String[] args)
Main method for testing this class. |
void |
removeVariable(String key)
Remove a named variable from the map. |
String |
substitute(String source)
Substitute a variable names for their values in the given string. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Environment()
| Method Detail |
|---|
public static Environment getSystemWide()
public static boolean containsEnvVariables(String source)
source - the string to test
public String substitute(String source)
throws Exception
source - the source string to replace variables in
Exception - if an unknown variable name is encountered
public void addVariable(String key,
String value)
key - the name of the variablevalue - its value
public void addVariableSystemWide(String key,
String value)
key - the name of the variablevalue - its valuepublic void removeVariable(String key)
key - the name of the varaible to remove.public Set<String> getVariableNames()
public String getVariableValue(String key)
key - the name of the variable to get
public static void main(String[] args)
args - a list of strings to replace variables in
(e.g. "\${os.name} "\${java.version}")public String getRevision()
getRevision in interface RevisionHandler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||