If an instantiated class inherits the abstract [https://github.com/BaseXdb/basex/blob/master/src/main/java/org/basex/query/QueryModule.java QueryModule] class of BaseX, it will get access to the {{Mono|context}} variable, which is an instance of the [https://github.com/BaseXdb/basex/blob/master/src/main/java/org/basex/query/QueryContext.java QueryContext] class. It provides access to all static and dynamic properties of the current query. Additionally, the default properties of functions can be changed via annotations:
* Java functions can only be executed by users with {{Mono[[User_Management|ADMIN}} Admin permissions]]. You may annotate a function with {{Mono|Requires(Permission)}} to also make it accessible to other users with less permissions.* Java code is treated as "''non-deterministic"'', as its behavior cannot be predicted from by the XQuery processor. You may annotate a function as {{Mono|Deterministic}} if you know that it will have no side-effects and will always yield the same result.* Java code is treated as "''context-independent"''. If a function accesses the query context, it should be annotated as {{Mono|ContextDependent}}* Java code is treated as "''focus-independent"''. If a function accesses the current context item, position or size, it should be annotated as {{Mono|FocusDependent}}
The following XQuery code invokes two Java methods. The first Java function retrieves information from the static query context, and the second one throws a query exception:
<to-int>Error in line 6</to-int>
</pre>
You may visit the XQuery 3.0 specification to get more insight into
[http://www.w3.org/TR/xpath-functions-30/#properties-of-functions function properties].
=Changelog=