Interface Function

    • Method Detail

      • isMap

        boolean isMap()
        Ask whether this function item is a map
        Returns:
        true if this function item is a map, otherwise false
      • isArray

        boolean isArray()
        Ask whether this function item is an array
        Returns:
        true if this function item is an array, otherwise false
      • getFunctionItemType

        FunctionItemType getFunctionItemType()
        Get the item type of the function item
        Returns:
        the function item's type
      • getFunctionName

        StructuredQName getFunctionName()
        Get the name of the function, or null if it is anonymous
        Returns:
        the function name, or null for an anonymous inline function
      • getArity

        int getArity()
        Get the arity of the function
        Returns:
        the number of arguments in the function signature
      • getOperandRoles

        OperandRole[] getOperandRoles()
        Get the roles of the arguments, for the purposes of streaming
        Returns:
        an array of OperandRole objects, one for each argument
      • getAnnotations

        AnnotationList getAnnotations()
        Get the function annotations (as defined in XQuery). Returns an empty list if there are no function annotations.
        Returns:
        the function annotations
      • makeNewContext

        XPathContext makeNewContext​(XPathContext callingContext,
                                    ContextOriginator originator)
        Prepare an XPathContext object for evaluating the function
        Parameters:
        callingContext - the XPathContext of the function calling expression
        originator - identifies the location of the caller for diagnostics
        Returns:
        a suitable context for evaluating the function (which may or may not be the same as the caller's context)
      • call

        Sequence call​(XPathContext context,
                      Sequence[] args)
               throws XPathException
        Invoke the function
        Specified by:
        call in interface Callable
        Parameters:
        context - the XPath dynamic evaluation context
        args - the actual arguments to be supplied
        Returns:
        the result of invoking the function
        Throws:
        XPathException - if a dynamic error occurs within the function
      • deepEquals

        boolean deepEquals​(Function other,
                           XPathContext context,
                           AtomicComparer comparer,
                           int flags)
                    throws XPathException
        Test whether this FunctionItem is deep-equal to another function item, under the rules of the deep-equal function
        Parameters:
        other - the other function item
        context - the dynamic evaluation context
        comparer - the object to perform the comparison
        flags - options for how the comparison is performed
        Returns:
        true if the two function items are deep-equal
        Throws:
        XPathException - if the comparison cannot be performed
      • getDescription

        java.lang.String getDescription()
        Get a description of this function for use in error messages. For named functions, the description is the function name (as a lexical QName). For others, it might be, for example, "inline function", or "partially-applied ends-with function".
        Returns:
        a description of the function for use in error messages
      • isTrustedResultType

        boolean isTrustedResultType()
        Check that result type is of the trusted system functions to return a result of the correct type
      • toShortString

        default java.lang.String toShortString()
        Provide a short string showing the contents of the item, suitable for use in error messages
        Specified by:
        toShortString in interface GroundedValue
        Specified by:
        toShortString in interface Item
        Returns:
        a depiction of the item suitable for use in error messages
      • getGenre

        default Genre getGenre()
        Get the genre of this item
        Specified by:
        getGenre in interface Item
        Returns:
        the genre: specifically, Genre.FUNCTION. Overridden for maps and arrays.
      • argumentArray

        @SafeVarargs
        static Sequence[] argumentArray​(Sequence... args)