Class KeyFn

    • Constructor Detail

      • KeyFn

        public KeyFn()
    • Method Detail

      • getKeyManager

        public KeyManager getKeyManager()
      • internalKeyCall

        public static Expression internalKeyCall​(KeyManager keyManager,
                                                 KeyDefinitionSet keySet,
                                                 java.lang.String name,
                                                 Expression value,
                                                 Expression doc,
                                                 RetainedStaticContext rsc)
        Factory method to create an internal call on key() with a known key definition
        keySet - the set of KeyDefinitions (always a single KeyDefinition)
        name - the name allocated to the key (first argument of the function)
        value - the value being searched for (second argument of the function)
        doc - the document being searched (third argument)
        a call on the key() function
      • getSpecialProperties

        public int getSpecialProperties​(Expression[] arguments)
        Get the static properties of this expression (other than its type). The result is bit-signficant. These properties are used for optimizations. In general, if a property bit is set, it is true, but if it is unset, the value is unknown.
        getSpecialProperties in class SystemFunction
        arguments - expressions supplied as arguments in the function call
      • copy

        public SystemFunction copy()
        Description copied from interface: StatefulSystemFunction
        Make a copy of this SystemFunction. This is required only for system functions such as regex functions that maintain state on behalf of a particular caller.
        Specified by:
        copy in interface StatefulSystemFunction
        a copy of the system function able to contain its own copy of the state on behalf of the caller.
      • fixArguments

        public Expression fixArguments​(Expression... arguments)
                                throws XPathException
        Allow the function to create an optimized call based on the values of the actual arguments. This binds the key definition in the common case where the key name is defined statically
        fixArguments in class SystemFunction
        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
      • addToPathMap

        public PathMap.PathMapNodeSet addToPathMap​(PathMap pathMap,
                                                   PathMap.PathMapNodeSet pathMapNodeSet)
        Add a representation of this expression to a PathMap. The PathMap captures a map of the nodes visited by an expression in a source tree.

        The default implementation of this method assumes that an expression does no navigation other than the navigation done by evaluating its subexpressions, and that the subexpressions are evaluated in the same context as the containing expression. The method must be overridden for any expression where these assumptions do not hold. For example, implementations exist for AxisExpression, ParentExpression, and RootExpression (because they perform navigation), and for the doc(), document(), and collection() functions because they create a new navigation root. Implementations also exist for PathExpression and FilterExpression because they have subexpressions that are evaluated in a different context from the calling expression.

        pathMap - the PathMap to which the expression should be added
        pathMapNodeSet - the PathMapNodeSet to which the paths embodied in this expression should be added
        the pathMapNodeSet representing the points in the source document that are both reachable by this expression, and that represent possible results of this expression. For an expression that does navigation, it represents the end of the arc in the path map that describes the navigation route. For other expressions, it is the same as the input pathMapNode.
      • call

        public Sequence call​(XPathContext context,
                             Sequence[] arguments)
                      throws XPathException
        Evaluate the expression
        Specified by:
        call in interface Callable
        Specified by:
        call in interface Function
        context - the dynamic evaluation context
        arguments - the values of the arguments, supplied as Sequences
        the result of the evaluation, in the form of a Sequence
        XPathException - if a dynamic error occurs during the evaluation of the expression