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)
Output information about this function item to the diagnostic explain() output
|
int |
getArity()
Get the arity of the function
|
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, getStringValue, getStringValueCS, isArray, isMap, optimize, simplifygetLength, head, itemAt, iterate, reduce, subsequenceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLength, head, itemAt, reduce, subsequencepublic 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) throws XPathException
requiredType - the type of the coerced function, that is the type required
by the context in which the target function is being usedXPathExceptionpublic 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 AbstractFunctionvisitor - the expression visitor, supplies context informationcontextItemType - the context item type at the point where the function definition appearsXPathExceptionpublic FunctionItemType getFunctionItemType()
public StructuredQName getFunctionName()
public 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 suppliedXPathExceptionpublic 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)
export in interface Functionexport in class AbstractFunctionout - Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.