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()
-
Method Summary
Modifier and TypeMethodDescriptionvoid
declareVariable
(String name, Object value) Defines a new variable with the specified value or modifies the value of an existing variable.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
Defines a new variable with the specified value or modifies the value of an existing variable. May throw UnsupportedOperationException.- Parameters:
name
- variable namevalue
- 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
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
-