Class JAXPVariableReference
- java.lang.Object
-
- net.sf.saxon.expr.Expression
-
- net.sf.saxon.xpath.JAXPVariableReference
-
- All Implemented Interfaces:
Callable,ExportAgent,Locatable,IdentityComparable,Traceable
public class JAXPVariableReference extends Expression implements Callable
This class represents a variable in an XPath expression compiled using the JAXP XPath API. Although the class name suggests otherwise, the expression is not in fact a VariableReference; it's a custom expression which, on evaluation, calls the JAXP XPathVariableResolver to get the value of the variable.
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.expr.Expression
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_COST, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD
-
-
Constructor Summary
Constructors Constructor Description JAXPVariableReference(StructuredQName name, javax.xml.xpath.XPathVariableResolver resolver)Create the expression
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Sequencecall(XPathContext context, Sequence[] arguments)Call the Callable.intcomputeCardinality()Get the static cardinalityintcomputeHashCode()get HashCode for comparing two expressionsintcomputeSpecialProperties()Determine the special properties of this expressionExpressioncopy(RebindingMap rebindings)Create a clone copy of this expressionbooleanequals(java.lang.Object other)Is this expression the same as another expression?voidexport(ExpressionPresenter destination)Diagnostic print of expression structure.java.lang.StringgetExpressionName()Get a name identifying the kind of expression, in terms meaningful to a user.intgetImplementationMethod()An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().ItemTypegetItemType()Determine the item typeSequenceIteratoriterate(XPathContext context)Iterate over the value of the expressionjava.lang.StringtoString()The toString() method for an expression attempts to give a representation of the expression in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath.-
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getStreamerName, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operands, operandSparseList, optimize, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, toShortString, typeCheck, typeCheckChildren, typeError, unordered, verifyParentPointers
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.trace.Traceable
gatherProperties
-
-
-
-
Constructor Detail
-
JAXPVariableReference
public JAXPVariableReference(StructuredQName name, javax.xml.xpath.XPathVariableResolver resolver)
Create the expression
-
-
Method Detail
-
getExpressionName
public java.lang.String getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.- Overrides:
getExpressionNamein classExpression- Returns:
- a name identifying the kind of expression, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should match the name used in explain() output displaying the expression.
-
copy
public Expression copy(RebindingMap rebindings)
Create a clone copy of this expression- Specified by:
copyin classExpression- Parameters:
rebindings-- Returns:
- a copy of this expression
-
getItemType
public ItemType getItemType()
Determine the item type- Specified by:
getItemTypein classExpression- Returns:
- a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known at compile time)
-
computeCardinality
public int computeCardinality()
Get the static cardinality- Specified by:
computeCardinalityin classExpression- Returns:
- the computed cardinality, as one of the values
StaticProperty.ALLOWS_ZERO_OR_ONE,StaticProperty.EXACTLY_ONE,StaticProperty.ALLOWS_ONE_OR_MORE,StaticProperty.ALLOWS_ZERO_OR_MORE. May also returnStaticProperty.ALLOWS_ZEROif the result is known to be an empty sequence, orStaticProperty.ALLOWS_MANYif if is known to return a sequence of length two or more.
-
computeSpecialProperties
public int computeSpecialProperties()
Determine the special properties of this expression- Overrides:
computeSpecialPropertiesin classExpression- Returns:
- the value
StaticProperty.NO_NODES_NEWLY_CREATED
-
getImplementationMethod
public int getImplementationMethod()
Description copied from class:ExpressionAn implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is provided directly. The other methods will always be available indirectly, using an implementation that relies on one of the other methods.- Specified by:
getImplementationMethodin classExpression- Returns:
- the implementation method, for example
Expression.ITERATE_METHODorExpression.EVALUATE_METHODorExpression.PROCESS_METHOD
-
equals
public boolean equals(java.lang.Object other)
Is this expression the same as another expression?- Overrides:
equalsin classExpression- Parameters:
other- the other operand; the result is false if this is not an Expression- Returns:
- true if the other operand is an expression and if it can be determined that the two expressions are equivalent, in the sense that they will always return the same result.
-
computeHashCode
public int computeHashCode()
get HashCode for comparing two expressions- Overrides:
computeHashCodein classExpression- Returns:
- a computed hash code
-
call
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException
Description copied from interface:CallableCall the Callable.- Specified by:
callin interfaceCallable- Parameters:
context- the dynamic evaluation contextarguments- the values of the arguments, supplied as Sequences.Generally it is advisable, if calling iterate() to process a supplied sequence, to call it only once; if the value is required more than once, it should first be converted to a
GroundedValueby calling the utility method SequenceTool.toGroundedValue().If the expected value is a single item, the item should be obtained by calling Sequence.head(): it cannot be assumed that the item will be passed as an instance of
ItemorAtomicValue.It is the caller's responsibility to perform any type conversions required to convert arguments to the type expected by the callee. An exception is where this Callable is explicitly an argument-converting wrapper around the original Callable.
- Returns:
- the result of the evaluation, in the form of a Sequence. It is the responsibility of the callee to ensure that the type of result conforms to the expected result type.
- Throws:
XPathException- if a dynamic error occurs during the evaluation of the expression
-
iterate
public SequenceIterator iterate(XPathContext context) throws XPathException
Iterate over the value of the expression- Overrides:
iteratein classExpression- Parameters:
context- supplies the context for evaluation- Returns:
- a SequenceIterator that can be used to iterate over the result of the expression
- Throws:
XPathException- if any dynamic error occurs evaluating the expression
-
toString
public java.lang.String toString()
The toString() method for an expression attempts to give a representation of the expression in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath. In the case of XSLT instructions, the toString() method gives an abstracted view of the syntax- Overrides:
toStringin classExpression- Returns:
- a representation of the expression as a string
-
export
public void export(ExpressionPresenter destination) throws XPathException
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.- Specified by:
exportin interfaceExportAgent- Specified by:
exportin classExpression- Parameters:
destination- the expression presenter used to display the structure- Throws:
XPathException- if the export fails, for example if an expression is found that won't work in the target environment.
-
-