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
-
-
Constructor Summary
Constructors Constructor Description XdmFunctionItem(Function fi)
Create an XdmFunctionItem that wraps a suppliedFunction
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.function.Function<? super XdmValue,? extends XdmValue>
asFunction(Processor processor)
Get an equivalent Java Function object representing this XdmFunction.Step<XdmItem>
asStep(Processor processor)
Get an equivalent Step object representing this XdmFunction.XdmValue
call(Processor processor, XdmValue... arguments)
Call the functionint
getArity()
Get the arity of the functionQName
getName()
Get the name of the functionstatic XdmFunctionItem
getSystemFunction(Processor processor, QName name, int arity)
Get a system function.boolean
isAtomicValue()
Determine whether the item is an atomic value-
Methods 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, select, subsequence, toString, wrap, wrap
-
-
-
-
Constructor Detail
-
XdmFunctionItem
public XdmFunctionItem(Function fi)
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 Detail
-
getName
public QName 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
public java.util.function.Function<? super XdmValue,? extends XdmValue> asFunction(Processor processor)
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:
java.lang.IllegalStateException
- if the arity of the function is not one (1).
-
asStep
public Step<XdmItem> asStep(Processor processor)
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:
java.lang.IllegalStateException
- if the arity of the function is not one (1).
-
call
public XdmValue call(Processor processor, XdmValue... arguments) throws SaxonApiException
Call the function- Parameters:
arguments
- 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.processor
- the s9api Processor- Returns:
- the result of calling the function
- Throws:
SaxonApiException
- if an error is detected
-
-