Top Description Inners Fields Constructors Methods
org.apache.tools.ant.types

public Class Environment

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.tools.ant.types.CommandlineJava.SysProperties
Imports
java.util.Vector, org.apache.tools.ant.BuildException

Wrapper for environment variables.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Environment.Variable

representation of a single env value

Field Summary

Modifier and TypeField and Description
protected Vector<Environment.Variable>
variables

a vector of type Environment.Variable

Constructor Summary

AccessConstructor and Description
public
Environment()

constructor

Method Summary

Modifier and TypeMethod and Description
public void
addVariable(Environment.Variable
new variable.
var
)

add a variable.

public String[]

Returns:

array of key=value assignment strings
getVariables
()

get the variable list as an array

public Vector<Environment.Variable>

Returns:

a potentially empty (but never null) vector of elements of type Variable
getVariablesVector
()

Get the raw vector of variables.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

variablesback to summary
protected Vector<Environment.Variable> variables

a vector of type Environment.Variable

See Also
Variable

Constructor Detail

Environmentback to summary
public Environment()

constructor

Method Detail

addVariableback to summary
public void addVariable(Environment.Variable var)

add a variable. Validity checking is not performed at this point. Duplicates are not caught either.

Parameters
var:Environment.Variable

new variable.

getVariablesback to summary
public String[] getVariables() throws BuildException

get the variable list as an array

Returns:String[]

array of key=value assignment strings

Exceptions
BuildException:
if any variable is misconfigured
getVariablesVectorback to summary
public Vector<Environment.Variable> getVariablesVector()

Get the raw vector of variables. This is not a clone.

Returns:Vector<Environment.Variable>

a potentially empty (but never null) vector of elements of type Variable

Since
Ant 1.7
org.apache.tools.ant.types back to summary

public Class Environment.Variable

extends Object
Class Inheritance

representation of a single env value

Field Summary

Modifier and TypeField and Description
private String
key

env key and value pair; everything gets expanded to a string during assignment

private String
value

env key and value pair; everything gets expanded to a string during assignment

Constructor Summary

AccessConstructor and Description
public
Variable()

Constructor for variable

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

a string of the form key=value.
getContent
()

get the assignment string This is not ready for insertion into a property file without following the escaping rules of the properties class.

public String

Returns:

key
getKey
()

key accessor

public String

Returns:

value
getValue
()

value accessor

public void
setFile(File
file to use as the value
file
)

get the absolute path of a file and assign it to the value

public void
setKey(String
string
key
)

set the key

public void
setPath(Path
path
path
)

stringify path and assign to the value.

public void
setValue(String
string value
value
)

set the value

public void
validate()

checks whether all required attributes have been specified.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

keyback to summary
private String key

env key and value pair; everything gets expanded to a string during assignment

valueback to summary
private String value

env key and value pair; everything gets expanded to a string during assignment

Constructor Detail

Variableback to summary
public Variable()

Constructor for variable

Method Detail

getContentback to summary
public String getContent() throws BuildException

get the assignment string This is not ready for insertion into a property file without following the escaping rules of the properties class.

Returns:String

a string of the form key=value.

Exceptions
BuildException:
if key or value are unassigned
getKeyback to summary
public String getKey()

key accessor

Returns:String

key

getValueback to summary
public String getValue()

value accessor

Returns:String

value

setFileback to summary
public void setFile(File file)

get the absolute path of a file and assign it to the value

Parameters
file:File

file to use as the value

setKeyback to summary
public void setKey(String key)

set the key

Parameters
key:String

string

setPathback to summary
public void setPath(Path path)

stringify path and assign to the value. The value will contain all path elements separated by the appropriate separator

Parameters
path:Path

path

setValueback to summary
public void setValue(String value)

set the value

Parameters
value:String

string value

validateback to summary
public void validate()

checks whether all required attributes have been specified.

Exceptions
BuildException:
if key or value are unassigned