net.sf.saxon.expr
Class CastableExpression
- EvaluableItem, InstructionInfoProvider, SequenceIterable, Serializable, SourceLocator
public final class CastableExpression
Castable Expression: implements "Expr castable as atomic-type?".
The implementation simply wraps a cast expression with a try/catch.
computeCardinality , computeSpecialProperties , displayExpressionName , displayOperator , equals , explain , getBaseExpression , getItemType , hashCode , iterateSubExpressions , optimize , promote , replaceSubExpression , simplify , toString , typeCheck |
addToPathMap , adoptChildExpression , checkPermittedContents , computeCardinality , computeDependencies , computeSpecialProperties , computeStaticProperties , copy , display , doPromotion , dynamicError , effectiveBooleanValue , evaluateAsString , evaluateItem , explain , explain , findParentOf , getCardinality , getColumnNumber , getConstructType , getContainer , getDependencies , getExecutable , getHostLanguage , getImplementationMethod , getInstructionInfo , getIntrinsicDependencies , getItemType , getLineNumber , getLocationId , getLocationProvider , getPublicId , getSlotsUsed , getSpecialProperties , getSystemId , hasLoopingSubexpression , implementsStaticTypeCheck , iterate , iterateEvents , iterateSubExpressions , markTailFunctionCalls , optimize , process , promote , replaceSubExpression , resetLocalStaticProperties , setContainer , setFiltered , setFlattened , setLocationId , simplify , staticTypeCheck , suppressValidation , toString , typeCheck , typeError |
CastableExpression
public CastableExpression(Expression source,
AtomicType target,
boolean allowEmpty)
Create a "castable" expression of the form "source castable as target"
source
- The source expressiontarget
- The type being tested againstallowEmpty
- true if an empty sequence is acceptable, that is if the expression
was written as "source castable as target?"
allowsEmpty
public boolean allowsEmpty()
Determine whether the empty sequence is allowed
- true if an empty sequence is allowed
copy
public Expression copy()
Copy an expression. This makes a deep copy.
- copy in interface Expression
- the copy of the original expression
effectiveBooleanValue
public boolean effectiveBooleanValue(XPathContext context)
throws XPathException
Get the effective boolean value of the expression. This returns false if the value
is the empty sequence, a zero-length string, a number equal to zero, or the boolean
false. Otherwise it returns true.
- effectiveBooleanValue in interface Expression
context
- The context in which the expression is to be evaluated
- the effective boolean value
XPathException
- if any dynamic error occurs evaluating the
expression
equals
public boolean equals(Object other)
Is this expression the same as another expression?
- equals in interface UnaryExpression
explain
public void explain(ExpressionPresenter out)
Diagnostic print of expression structure. The abstract expression tree
is written to the supplied output destination.
- explain in interface UnaryExpression
getTargetType
public AtomicType getTargetType()
Get the target type
isCastable
public static boolean isCastable(AtomicValue value,
AtomicType targetType,
XPathContext context)
Determine whether a value is castable to a given type
value
- the value to be testedtargetType
- the type to be tested againstcontext
- XPath dynamic context
- true if the value is castable to the required type