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

# Class Environment.Variable

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

Enclosing class:
  `Environment`

public static class Environment.Variable extends Object
representation of a single env value

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Variable()`
  Constructor for variable

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getContent()`
  get the assignment string This is not ready for insertion into a property file without following the escaping rules of the properties class.
  `String`
  `getKey()`
  key accessor
  `String`
  `getValue()`
  value accessor
  `void`
  `setFile(File file)`
  get the absolute path of a file and assign it to the value
  `void`
  `setKey(String key)`
  set the key
  `void`
  `setPath(Path path)`
  stringify path and assign to the value.
  `void`
  `setValue(String value)`
  set the value
  `void`
  `validate()`
  checks whether all required attributes have been specified.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### Variable

    public Variable()
    Constructor for variable

- ## Method Details

  - ### setKey

    public void setKey(String key)
    set the key
    Parameters:
      `key` - string

  - ### setValue

    public void setValue(String value)
    set the value
    Parameters:
      `value` - string value

  - ### getKey

    public String getKey()
    key accessor
    Returns:
      key

  - ### getValue

    public String getValue()
    value accessor
    Returns:
      value

  - ### setPath

    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

  - ### setFile

    public void setFile(File file)
    get the absolute path of a file and assign it to the value
    Parameters:
      `file` - file to use as the value

  - ### getContent

    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:
      a string of the form key=value.
    Throws:
      `BuildException` - if key or value are unassigned

  - ### validate

    public void validate()
    checks whether all required attributes have been specified.
    Throws:
      `BuildException` - if key or value are unassigned