Package net.sf.saxon.s9api
Class XdmFunctionItem
java.lang.Object
net.sf.saxon.s9api.XdmValue
net.sf.saxon.s9api.XdmItem
net.sf.saxon.s9api.XdmFunctionItem
The class XdmFunctionItem represents a function item
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an XdmFunctionItem that wraps a suppliedFunction
. -
Method Summary
Modifier and TypeMethodDescriptionasFunction
(Processor processor) Get an equivalent Java Function object representing this XdmFunction.Get an equivalent Step object representing this XdmFunction.Call the functionint
getArity()
Get the arity of the functiongetName()
Get the name of the functionstatic XdmFunctionItem
getSystemFunction
(Processor processor, QName name, int arity) Get a system function.boolean
Determine whether the item is an atomic valueMethods inherited from class net.sf.saxon.s9api.XdmItem
asMap, getStringValue, getUnderlyingValue, getUnicodeStringValue, isNode, matches, size, stream, wrapItem, wrapItem, wrapItem
Methods inherited from class net.sf.saxon.s9api.XdmValue
append, documentOrder, isEmpty, itemAt, iterator, makeSequence, makeValue, matches, select, subsequence, toString, where, wrap, wrap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
XdmFunctionItem
Create an XdmFunctionItem that wraps a suppliedFunction
. This method is primarily for internal use, though it is also available to applications that manipulate data using lower-level Saxon interfaces.- Parameters:
fi
- the function value to be wrapped.
-
-
Method Details
-
getName
Get the name of the function- Returns:
- the function name, as a QName, or null for an anonymous inline function item
-
getArity
public int getArity()Get the arity of the function- Returns:
- the arity of the function, that is, the number of arguments in the function's signature
-
isAtomicValue
public boolean isAtomicValue()Determine whether the item is an atomic value- Overrides:
isAtomicValue
in classXdmItem
- Returns:
- false, the item is not an atomic value, it is a function item
-
getSystemFunction
public static XdmFunctionItem getSystemFunction(Processor processor, QName name, int arity) throws SaxonApiException Get a system function. This can be any function defined in XPath 3.1 functions and operators, including functions in the math, map, and array namespaces. It can also be a Saxon extension function, provided a licensed Processor is used.- Parameters:
processor
- the processorname
- the name of the requested functionarity
- the arity of the requested function- Returns:
- the requested function, or null if there is no such function. Note that some functions (those with particular context dependencies) may be unsuitable for dynamic calling.
- Throws:
SaxonApiException
- No longer thrown, but remains in the method signature for backwards compatibility
-
asFunction
Get an equivalent Java Function object representing this XdmFunction. This is possible only for arity-1 functions.- Parameters:
processor
- the processor- Returns:
- a Java Function. This takes an XdmValue as its argument, and returns the function result in the form of an XdmValue. The Function throws an unchecked exception if evaluation fails
- Throws:
IllegalStateException
- if the arity of the function is not one (1).
-
asStep
Get an equivalent Step object representing this XdmFunction. This is possible only for arity-1 functions.- Parameters:
processor
- the processor- Returns:
- a Step. This takes an XdmItem as its argument, and returns the function result in the form of an XdmStream. The Function throws an unchecked exception if evaluation fails
- Throws:
IllegalStateException
- if the arity of the function is not one (1).
-
call
Call the function- Parameters:
processor
- the s9api Processorarguments
- the values to be supplied as arguments to the function. The "function conversion rules" will be applied to convert the arguments to the required type when necessary.- Returns:
- the result of calling the function
- Throws:
SaxonApiException
- if an error is detected
-