Package org.apache.commons.jxpath

# Class BasicVariables

java.lang.Object
org.apache.commons.jxpath.BasicVariables

All Implemented Interfaces:
  `Serializable`, `Variables`

public class BasicVariables extends Object implements Variables
A basic implementation of the Variables interface that uses a HashMap.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BasicVariables()`
  Constructs a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `declareVariable(String varName, Object value)`
  Defines a new variable with the specified value or modifies the value of an existing variable.
  `Object`
  `getVariable(String varName)`
  Returns the value of the variable if it is defined, otherwise, throws IllegalArgumentException
  `boolean`
  `isDeclaredVariable(String varName)`
  Returns true if the variable has been defined, even if the value of the variable is null.
  `String`
  `toString()`
  `void`
  `undeclareVariable(String varName)`
  Removes an existing variable.

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

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

- ## Constructor Details

  - ### BasicVariables

    public BasicVariables()
    Constructs a new instance.

- ## Method Details

  - ### declareVariable

    public void declareVariable(String varName, Object value)
    Defines a new variable with the specified value or modifies the value of an existing variable.
    Specified by:
      `declareVariable` in interface `Variables`
    Parameters:
      `varName` - is a variable name without the "$" sign
      `value` - is the new value for the variable, which can be null

  - ### getVariable

    public Object getVariable(String varName)
    Returns the value of the variable if it is defined, otherwise, throws IllegalArgumentException
    Specified by:
      `getVariable` in interface `Variables`
    Parameters:
      `varName` - is a variable name without the "$" sign
    Returns:
      the value of the variable

  - ### isDeclaredVariable

    public boolean isDeclaredVariable(String varName)
    Returns true if the variable has been defined, even if the value of the variable is null.
    Specified by:
      `isDeclaredVariable` in interface `Variables`
    Parameters:
      `varName` - is a variable name without the "$" sign
    Returns:
      true if the variable is declared

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### undeclareVariable

    public void undeclareVariable(String varName)
    Removes an existing variable. May throw UnsupportedOperationException.
    Specified by:
      `undeclareVariable` in interface `Variables`
    Parameters:
      `varName` - is a variable name without the "$" sign