Changes

Jump to navigation Jump to search
597 bytes added ,  20:09, 20 January 2016
==Functions and Variables==
Both Java variables and Java function are referenced and evaluated by usual XQuery function calls. : * The namespace of the function name of a function identifies the Java class, and the .* The local partof the name, which is rewritten to camel case, identifies a variable or function of that class* The middle dot character (<code>[http://www.fileformat.info/info/unicode/char/b7/index.htm ·/&amp;#xB7;]</code>) is a valid character in XQuery names, but not in Java. It can be used to append exact Java parameter types to the function name:
{| class="wikitable"
| Variable
| <code>Q{java.lang.Integer}MIN_VALUE#0</code>
| <code>[https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html#MAX_VALUE Integer.MIN_VALUE]</code>
|- valign="top"
| Function
| <code>Q{java.lang.Object}hash-code#0</code>
| <code>[https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode()Object#hashCode()]</code>|- valign="top"| Function with types| <code>Q{java.lang.String}split·java.lang.String·int#2</code>| <code>[https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#split-java.lang.String-int- String#split(";", 3)]</code>
|}
As XQuery and Java have different type systems, XQuery arguments are converted to equivalent Java values, and the result of a Java function is converted back to an XQuery value. A table with all mappings is listed (see [[#Data Types|at the endData Types]] of this article).
If a Java function is not found, it XQuery values may help need to explicitly be cast your XQuery valuesthe target type. For example, if a Java function expects a primitive {{Code|int}} value, you will need to convert your XQuery integers to {{Code|xs:int}}.
=Namespace Declarations=
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu