Package org.apache.commons.jxpath
Interface Variables
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
BasicVariables
,KeywordVariables
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()
- Version:
- $Revision: 652925 $ $Date: 2008-05-02 17:05:41 -0500 (Fri, 02 May 2008) $
-
Method Summary
Modifier and TypeMethodDescriptionvoid
declareVariable
(String varName, Object value) Defines a new variable with the specified value or modifies the value of an existing variable.getVariable
(String varName) Returns the value of the specified variable.boolean
isDeclaredVariable
(String varName) Returns true if the specified variable is declared.void
undeclareVariable
(String varName) Removes an existing variable.
-
Method Details
-
isDeclaredVariable
Returns true if the specified variable is declared.- Parameters:
varName
- variable name- Returns:
- boolean
-
getVariable
Returns the value of the specified variable.- Parameters:
varName
- variable name- Returns:
- Object value
- Throws:
IllegalArgumentException
- if there is no such variable.
-
declareVariable
Defines a new variable with the specified value or modifies the value of an existing variable. May throw UnsupportedOperationException.- Parameters:
varName
- variable namevalue
- to declare
-
undeclareVariable
Removes an existing variable. May throw UnsupportedOperationException.- Parameters:
varName
- is a variable name without the "$" sign
-