public final class Variable extends Object implements VariableDeclaration, Binding, Serializable
Modifier and Type | Method and Description |
---|---|
ValueRepresentation |
evaluateVariable(XPathContext context)
Get the value of the variable.
|
int |
getLocalSlotNumber()
If this is a local variable held on the local stack frame, return the corresponding slot number.
|
int |
getNameCode()
Establish the nameCode of the name of this variable.
|
String |
getVariableName()
Get the name of the variable.
|
boolean |
isAssignable()
Test whether it is permitted to assign to the variable using the saxon:assign
extension element.
|
boolean |
isGlobal()
Indicate whether the binding is local or global.
|
static Variable |
make(QNameValue name,
Configuration config)
Factory method, for use by the declareVariable method of class StandaloneContext
|
static Variable |
make(String qname,
Configuration config)
Deprecated.
since 8.5: use
make(QNameValue, Configuration) |
void |
registerReference(BindingReference ref)
Method called by the XPath expression parser to register a reference to this variable.
|
void |
setSlotNumber(int slotNumber)
Set the slot number allocated to this variable
|
void |
setUseStack(boolean useStack)
Indicate that values of variables are to be found on the stack, not
in the Variable object itself
|
void |
setValue(Object value)
Assign a value to the variable.
|
void |
setXPathValue(ValueRepresentation value)
Assign a value to the variable.
|
public static Variable make(QNameValue name, Configuration config)
public static Variable make(String qname, Configuration config) throws XPathException
make(QNameValue, Configuration)
qname
- the lexical QName of the variable nameXPathException
public void setUseStack(boolean useStack)
public boolean isGlobal()
public final boolean isAssignable()
isAssignable
in interface Binding
public void setSlotNumber(int slotNumber)
slotNumber
- public int getLocalSlotNumber()
getLocalSlotNumber
in interface Binding
public String getVariableName()
getVariableName
in interface VariableDeclaration
public int getNameCode()
getNameCode
in interface VariableDeclaration
public void setValue(Object value) throws XPathException
value
- the value of the variable, as a Java object. This is converted to the "best fit"
XPath data type.XPathException
- if the Java value cannot be converted to an XPath typepublic void setXPathValue(ValueRepresentation value)
value
- the value of the variable, which must be an instance of a class
representing a value in the XPath model.public void registerReference(BindingReference ref)
registerReference
in interface VariableDeclaration
public ValueRepresentation evaluateVariable(XPathContext context)
evaluateVariable
in interface Binding
context
- The dynamic evaluation context