|
||||||||||
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 as well as a method for replacing key names (enclosed by ${}) with their associated value in Strings.
Constructor Summary | |
---|---|
Environment()
|
Method Summary | |
---|---|
static void |
addVariable(java.lang.String key,
java.lang.String value)
Add a variable to the internal map. |
java.lang.String |
getRevision()
Returns the revision string. |
static java.util.Set<java.lang.String> |
getVariableNames()
Get the names of the variables (keys) stored in the internal map. |
static java.lang.String |
getVariableValue(java.lang.String key)
Get the value for a particular variable. |
static void |
main(java.lang.String[] args)
Main method for testing this class. |
static void |
removeVariable(java.lang.String key)
Remove a named variable from the map. |
static java.lang.String |
substitute(java.lang.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 java.lang.String substitute(java.lang.String source) throws java.lang.Exception
source
- the source string to replace variables in
java.lang.Exception
- if an unknown variable name is encounteredpublic static void addVariable(java.lang.String key, java.lang.String value)
key
- the name of the variablevalue
- its valuepublic static void removeVariable(java.lang.String key)
key
- the name of the varaible to remove.public static java.util.Set<java.lang.String> getVariableNames()
public static java.lang.String getVariableValue(java.lang.String key)
key
- the name of the variable to get
public static void main(java.lang.String[] args)
a
- list of strings to replace variables in
(e.g. "\${os.name} "\${java.version}")public java.lang.String getRevision()
getRevision
in interface RevisionHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |