Package net.sf.saxon.expr.elab
Class OptionalItemEvaluator
- java.lang.Object
-
- net.sf.saxon.expr.elab.OptionalItemEvaluator
-
- All Implemented Interfaces:
SequenceEvaluator
public class OptionalItemEvaluator extends java.lang.Object implements SequenceEvaluator
A SequenceEvaluator for expressions that return a sequence of zero or one items. Unlike theSingleItemEvaluator
, it checks whether the underlyingItemEvaluator
has returned null, and if so, returns an empty sequence rather than a single item.
-
-
Constructor Summary
Constructors Constructor Description OptionalItemEvaluator(ItemEvaluator eval)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Sequence
evaluate(XPathContext context)
Evaluate a construct to produce a value (which might be a lazily evaluated Sequence)
-
-
-
Constructor Detail
-
OptionalItemEvaluator
public OptionalItemEvaluator(ItemEvaluator eval)
-
-
Method Detail
-
evaluate
public Sequence evaluate(XPathContext context) throws XPathException
Evaluate a construct to produce a value (which might be a lazily evaluated Sequence)- Specified by:
evaluate
in interfaceSequenceEvaluator
- Parameters:
context
- the evaluation context- Returns:
- a Sequence (not necessarily grounded). This will be an
EmptySequence
if the underlyingItemEvaluator
returns null. - Throws:
XPathException
- if a dynamic error occurs during the evaluation.
-
-