Environment (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.types, class: Environment

Package org.apache.tools.ant.types

# Class Environment

java.lang.Object
org.apache.tools.ant.types.Environment

Direct Known Subclasses:
  `CommandlineJava.SysProperties`

public class Environment extends Object
Wrapper for environment variables.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `Environment.Variable`
  representation of a single env value

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Vector<Environment.Variable>`
  `variables`
  a vector of type Environment.Variable

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Environment()`
  constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addVariable(Environment.Variable var)`
  add a variable.
  `String[]`
  `getVariables()`
  get the variable list as an array
  `Vector<Environment.Variable>`
  `getVariablesVector()`
  Get the raw vector of variables.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### variables

    protected Vector<Environment.Variable> variables
    a vector of type Environment.Variable
    See Also:
      - `Environment.Variable`

- ## Constructor Details

  - ### Environment

    public Environment()
    constructor

- ## Method Details

  - ### addVariable

    public void addVariable(Environment.Variable var)
    add a variable. Validity checking is not performed at this point. Duplicates are not caught either.
    Parameters:
      `var` - new variable.

  - ### getVariables

    public String[] getVariables() throws BuildException
    get the variable list as an array
    Returns:
      array of key=value assignment strings
    Throws:
      `BuildException` - if any variable is misconfigured

  - ### getVariablesVector

    public Vector<Environment.Variable> getVariablesVector()
    Get the raw vector of variables. This is not a clone.
    Returns:
      a potentially empty (but never null) vector of elements of type Variable
    Since:
      Ant 1.7