Package org.apache.commons.jxpath
Class BasicVariables
- java.lang.Object
-
- org.apache.commons.jxpath.BasicVariables
-
- All Implemented Interfaces:
java.io.Serializable,Variables
public class BasicVariables extends java.lang.Object implements Variables
A basic implementation of the Variables interface that uses a HashMap.- Version:
- $Revision: 652925 $ $Date: 2008-05-02 17:05:41 -0500 (Fri, 02 May 2008) $
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUIDprivate java.util.HashMapvarsContains the values of declared variables
-
Constructor Summary
Constructors Constructor Description BasicVariables()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeclareVariable(java.lang.String varName, java.lang.Object value)Defines a new variable with the specified value or modifies the value of an existing variable.java.lang.ObjectgetVariable(java.lang.String varName)Returns the value of the variable if it is defined, otherwise, throws IllegalArgumentExceptionbooleanisDeclaredVariable(java.lang.String varName)Returns true if the variable has been defined, even if the value of the variable is null.java.lang.StringtoString()voidundeclareVariable(java.lang.String varName)Removes an existing variable.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
vars
private java.util.HashMap vars
Contains the values of declared variables
-
-
Method Detail
-
isDeclaredVariable
public boolean isDeclaredVariable(java.lang.String varName)
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
-
getVariable
public java.lang.Object getVariable(java.lang.String varName)
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
-
declareVariable
public void declareVariable(java.lang.String varName, java.lang.Object value)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
-
undeclareVariable
public void undeclareVariable(java.lang.String varName)
Removes an existing variable. May throw UnsupportedOperationException.- Specified by:
undeclareVariablein interfaceVariables- Parameters:
varName- is a variable name without the "$" sign
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-