public class CoercedFunction extends AbstractFunction
Constructor and Description |
---|
CoercedFunction(Function targetFunction,
SpecificFunctionType requiredType)
Create a CoercedFunction as a wrapper around a target function
|
CoercedFunction(SpecificFunctionType requiredType)
Create a CoercedFunction whose target function is not yet known (happens during package re-loading)
|
Modifier and Type | Method and Description |
---|---|
Sequence |
call(XPathContext context,
Sequence[] args)
Invoke the function
|
static CoercedFunction |
coerce(Function suppliedFunction,
SpecificFunctionType requiredType,
RoleDiagnostic role)
Factory method to create a CoercedFunction with a given type, for a given targetFunction.
|
void |
export(ExpressionPresenter out)
Export information about this function item to the SEF file
|
AnnotationList |
getAnnotations()
Get the function annotations.
|
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
|
void |
setTargetFunction(Function targetFunction)
Set the target function
|
void |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType)
Type check the function (may modify it by adding code for converting the arguments)
|
atomize, deepEquals, effectiveBooleanValue, getOperandRoles, getUnicodeStringValue, isArray, isMap, isTrustedResultType, makeNewContext, simplify, toShortString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getGenre, isSequenceVariadic
getLength, getStringValue, head, isStreamed, itemAt, iterate, reduce, subsequence
asIterable, concatenate, containsNode, materialize
makeRepeatable
public CoercedFunction(Function targetFunction, SpecificFunctionType requiredType) throws XPathException
targetFunction
- the function to be wrapped by a type-checking layerrequiredType
- the type of the coerced function, that is the type required
by the context in which the target function is being usedXPathException
- if the arity of the supplied function does not match the arity of the required typepublic CoercedFunction(SpecificFunctionType requiredType)
requiredType
- the type of the coerced function, that is the type required
by the context in which the target function is being usedpublic void setTargetFunction(Function targetFunction) throws XPathException
targetFunction
- the function to be wrapped by a type-checking layerXPathException
- if the arity of the supplied function does not match the arity of the required typepublic void typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
typeCheck
in class AbstractFunction
visitor
- the expression visitor, supplies context informationcontextItemType
- the context item type at the point where the function definition appearsXPathException
- if type checking of the target function failspublic FunctionItemType getFunctionItemType()
public StructuredQName getFunctionName()
public java.lang.String getDescription()
public int getArity()
public AnnotationList getAnnotations()
getAnnotations
in interface Function
getAnnotations
in class AbstractFunction
public Sequence call(XPathContext context, Sequence[] args) throws XPathException
context
- the XPath dynamic evaluation contextargs
- the actual arguments to be suppliedXPathException
- if execution of the function failspublic static CoercedFunction coerce(Function suppliedFunction, SpecificFunctionType requiredType, RoleDiagnostic role) throws XPathException
suppliedFunction
- the function to be coercedrequiredType
- the target type for the coercionrole
- diagnostic information about the role of the expression being coercedXPathException
- if the function cannot be coerced to the required type (for example,
because it has the wrong arity)public void export(ExpressionPresenter out) throws XPathException
export
in interface Function
export
in class AbstractFunction
out
- the SEF output destinationXPathException
- if things go wrongCopyright (c) 2004-2022 Saxonica Limited. All rights reserved.