public class CoercedFunction extends AbstractFunctionItem
Constructor and Description |
---|
CoercedFunction(FunctionItem targetFunction)
Create a CoercedFunction as a wrapper around a target function
|
Modifier and Type | Method and Description |
---|---|
Sequence |
call(XPathContext context,
Sequence[] args)
Invoke the function
|
static CoercedFunction |
coerce(FunctionItem suppliedFunction,
SpecificFunctionType requiredType,
RoleLocator role,
TypeCheckerEnvironment visitor)
Factory method to create a CoercedFunction with a given type, for a given targetFunction.
|
int |
getArity()
Get the arity of the function
|
FunctionItemType |
getFunctionItemType(TypeHierarchy th)
Get the item type of the function item
|
StructuredQName |
getFunctionName()
Get the name of the function, or null if it is anonymous
|
void |
setArgumentConverter(int arg,
Expression converter)
Set the argument converter for one argument
|
void |
setResultConverter(Expression converter)
Set the converter used to process the returned value
|
void |
setStackFrameMap(SlotManager stackFrame)
Set the stack frame map identifying the arguments for conversion
|
void |
typeCheck(ExpressionVisitor visitor,
ExpressionVisitor.ContextItemType contextItemType)
Type check the function (may modify it by adding code for converting the arguments)
|
deepEquals, effectiveBooleanValue, explain, getStringValue, getStringValueCS, getTypedValue, optimize, simplify
getLength, head, itemAt, iterate, reduce, subsequence
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLength, itemAt, reduce, subsequence
public CoercedFunction(FunctionItem targetFunction)
targetFunction
- the function to be wrapped by a type-checking layerpublic void setArgumentConverter(int arg, Expression converter)
arg
- identifies the argument to be convertedconverter
- the expression used to perform the conversionpublic void setResultConverter(Expression converter)
converter
- the expression used to perform the conversionpublic void setStackFrameMap(SlotManager stackFrame)
stackFrame
- public void typeCheck(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType) throws XPathException
typeCheck
in class AbstractFunctionItem
visitor
- the expression visitor, supplies context informationcontextItemType
- the context item type at the point where the function definition appearsXPathException
public FunctionItemType getFunctionItemType(TypeHierarchy th)
th
- public StructuredQName getFunctionName()
public int getArity()
public Sequence call(XPathContext context, Sequence[] args) throws XPathException
context
- the XPath dynamic evaluation contextargs
- the actual arguments to be suppliedXPathException
public static CoercedFunction coerce(FunctionItem suppliedFunction, SpecificFunctionType requiredType, RoleLocator role, TypeCheckerEnvironment visitor) throws XPathException
XPathException
Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.