Package org.apache.commons.jxpath

# Interface Variables

All Superinterfaces:
  `Serializable`

All Known Implementing Classes:
  `BasicVariables`, `KeywordVariables`

public interface Variables extends Serializable
Variables provide access to a global set of values accessible via XPath. XPath can reference variables using the `"$varname"` syntax. To use a custom implementation of this interface, pass it to `JXPathContext.setVariables()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `declareVariable(String name, Object value)`
  Defines a new variable with the specified value or modifies the value of an existing variable.
  `Object`
  `getVariable(String name)`
  Returns the value of the specified variable.
  `boolean`
  `isDeclaredVariable(String name)`
  Returns true if the specified variable is declared.
  `void`
  `undeclareVariable(String name)`
  Removes an existing variable.

- ## Method Details

  - ### declareVariable

    void declareVariable(String name, Object value)
    Defines a new variable with the specified value or modifies the value of an existing variable. May throw UnsupportedOperationException.
    Parameters:
      `name` - variable name
      `value` - to declare

  - ### getVariable

    Object getVariable(String name)
    Returns the value of the specified variable.
    Parameters:
      `name` - variable name
    Returns:
      Object value
    Throws:
      `IllegalArgumentException` - if there is no such variable.

  - ### isDeclaredVariable

    boolean isDeclaredVariable(String name)
    Returns true if the specified variable is declared.
    Parameters:
      `name` - variable name
    Returns:
      boolean

  - ### undeclareVariable

    void undeclareVariable(String name)
    Removes an existing variable. May throw UnsupportedOperationException.
    Parameters:
      `name` - is a variable name without the "$" sign