Class ApplyFn

  • All Implemented Interfaces:
    Callable, Function, GroundedValue, Item, Sequence

    public class ApplyFn
    extends SystemFunction
    This class implements the function fn:apply(), which is a standard function in XQuery 3.1. The fn:apply function is also used internally to implement dynamic function calls.
    • Constructor Detail

      • ApplyFn

        public ApplyFn()
    • Method Detail

      • setDynamicFunctionCall

        public void setDynamicFunctionCall​(java.lang.String fnExpr)
        Say that this call to fn:apply was originally written as a dynamic function call
        fnExpr - string representation of the expression used as the dynamic call
      • isDynamicFunctionCall

        public boolean isDynamicFunctionCall()
        Ask whether this call to fn:apply was originally written as a dynamic function call
        true if it was originally a dynamic function call
      • getResultItemType

        public ItemType getResultItemType​(Expression[] args)
        Get the return type, given knowledge of the actual arguments
        getResultItemType in class SystemFunction
        args - the actual arguments supplied
        the best available item type that the function will return
      • makeOptimizedFunctionCall

        public Expression makeOptimizedFunctionCall​(ExpressionVisitor visitor,
                                                    ContextItemStaticInfo contextInfo,
                                                    Expression... arguments)
                                             throws XPathException
        Description copied from class: SystemFunction
        Allow the function to create an optimized call based on the values of the actual arguments
        makeOptimizedFunctionCall in class SystemFunction
        visitor - the expression visitor
        contextInfo - information about the context item
        arguments - the supplied arguments to the function call. Note: modifying the contents of this array should not be attempted, it is likely to have no effect.
        either a function call on this function, or an expression that delivers the same result, or null indicating that no optimization has taken place
        XPathException - if an error is detected
      • call

        public Sequence call​(XPathContext context,
                             Sequence[] arguments)
                      throws XPathException
        Evaluate the expression
        context - the dynamic evaluation context
        arguments - the values of the arguments. The first argument is the function item to be called; the second argument is an array containing the arguments to be passed to that function, before conversion.
        the result of the evaluation, in the form of a SequenceIterator
        XPathException - if a dynamic error occurs during the evaluation of the expression
      • exportAttributes

        public void exportAttributes​(ExpressionPresenter out)
        Description copied from class: SystemFunction
        Export any context attributes held within the SystemFunction object. The implementation will normally make one or more calls on out.emitAttribute(name, value).
        exportAttributes in class SystemFunction
        out - the export destination
      • importAttributes

        public void importAttributes​(java.util.Properties attributes)
        Import any attributes found in the export file, that is, any attributes output using the exportAttributes method
        importAttributes in class SystemFunction
        attributes - the attributes, as a properties object