Package org.apache.commons.jxpath
Class BasicVariables
java.lang.Object
org.apache.commons.jxpath.BasicVariables
- All Implemented Interfaces:
Serializable,Variables
A basic implementation of the Variables interface that uses a HashMap.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeclareVariable(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 variable if it is defined, otherwise, throws IllegalArgumentExceptionbooleanisDeclaredVariable(String varName) Returns true if the variable has been defined, even if the value of the variable is null.toString()voidundeclareVariable(String varName) Removes an existing variable.
-
Constructor Details
-
BasicVariables
public BasicVariables()Constructs a new instance.
-
-
Method Details
-
declareVariable
Defines a new variable with the specified value or modifies the value of an existing variable.- Specified by:
declareVariablein interfaceVariables- Parameters:
varName- is a variable name without the "$" signvalue- is the new value for the variable, which can be null
-
getVariable
Returns the value of the variable if it is defined, otherwise, throws IllegalArgumentException- Specified by:
getVariablein interfaceVariables- Parameters:
varName- is a variable name without the "$" sign- Returns:
- the value of the variable
-
isDeclaredVariable
Returns true if the variable has been defined, even if the value of the variable is null.- Specified by:
isDeclaredVariablein interfaceVariables- Parameters:
varName- is a variable name without the "$" sign- Returns:
- true if the variable is declared
-
toString
-
undeclareVariable
Removes an existing variable. May throw UnsupportedOperationException.- Specified by:
undeclareVariablein interfaceVariables- Parameters:
varName- is a variable name without the "$" sign
-