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 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

      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

      Removes an existing variable. May throw UnsupportedOperationException.
      Parameters:
      name - is a variable name without the "$" sign