public class UnionConstructorFunction extends AbstractFunction
Modifier and Type | Field and Description |
---|---|
protected boolean |
allowEmpty |
protected NamespaceResolver |
resolver |
protected UnionType |
targetType |
Constructor and Description |
---|
UnionConstructorFunction(UnionType targetType,
NamespaceResolver resolver,
boolean allowEmpty)
Create a cast expression to a union type
|
Modifier and Type | Method and Description |
---|---|
AtomicSequence |
call(XPathContext context,
Sequence[] args)
Invoke the function
|
AtomicSequence |
cast(AtomicValue value,
XPathContext context)
Method to perform the cast of an atomic value to a union type
|
int |
getArity()
Get the arity of the function
|
java.lang.String |
getDescription()
Get a description of this function for use in error messages.
|
FunctionItemType |
getFunctionItemType()
Get the item type of the function item
|
StructuredQName |
getFunctionName()
Get the name of the function, or null if it is anonymous
|
NamespaceResolver |
getNamespaceResolver()
Get the namespace resolver that will be used to resolve any namespace-sensitive values (such as QNames) when casting
|
protected OperandRole |
getOperandRole()
Get the usage (in terms of streamability analysis) of the single operand
|
UnionType |
getTargetType()
Get the union type that is the target of this cast operation
|
boolean |
isAllowEmpty()
Ask whether the value of the operand is allowed to be empty
|
atomize, deepEquals, effectiveBooleanValue, export, getAnnotations, getOperandRoles, getStringValue, getStringValueCS, isArray, isMap, isTrustedResultType, makeNewContext, simplify, typeCheck
getLength, head, isStreamed, itemAt, iterate, reduce, subsequence
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLength, head, itemAt, reduce, subsequence
protected UnionType targetType
protected NamespaceResolver resolver
protected boolean allowEmpty
public UnionConstructorFunction(UnionType targetType, NamespaceResolver resolver, boolean allowEmpty)
targetType
- the union type that is the result of the castallowEmpty
- true if an empty sequence may be supplied as input, converting to an empty sequence on outputprotected OperandRole getOperandRole()
public boolean isAllowEmpty()
public UnionType getTargetType()
public NamespaceResolver getNamespaceResolver()
public FunctionItemType getFunctionItemType()
public StructuredQName getFunctionName()
public java.lang.String getDescription()
public int getArity()
public AtomicSequence cast(AtomicValue value, XPathContext context) throws XPathException
value
- the input value to be converted. Must not be null.context
- the evaluation contextXPathException
- if the conversion failspublic AtomicSequence call(XPathContext context, Sequence[] args) throws XPathException
context
- the XPath dynamic evaluation contextargs
- the actual arguments to be suppliedXPathException
- if a dynamic error occurs within the functionCopyright (c) 2004-2018 Saxonica Limited. All rights reserved.