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
|
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, getAnnotations, getOperandRoles, getStringValue, getStringValueCS, isArray, isMap, isTrustedResultType, makeNewContext, simplify
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
argumentArray, getGenre, toShortString
getLength, head, isStreamed, itemAt, iterate, iterator, reduce, subsequence, toGroundedValue
asIterable, 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 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
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.