On Feb 16, 2022, at 10:15 AM, Johan Mörén <johan.moren@gmail.com> wrote:
In your case, i think, java:TITLE() would work.
Just trying with java.lang.Integer i got the following code to workdeclare namespace integer="java:java.lang.Integer";
integer:MIN_VALUE()
On Wed, Feb 16, 2022 at 2:55 PM Paul L. Merchant Jr. <Paul.L.Merchant.Jr@dartmouth.edu> wrote:
Hi everyone, I'm using a Java library in XQuery in BaseX and I haven't been able to determine if there's a way to access a constant string (final static String... or even just final String...) in the Java class from XQuery.
For example, if the Java class is declared as
package my.module;
public class MyModule {
public static final String TITLE ="I'm a module!";
public String hello(final String world) {
return "Hello " + world;
}
}
The XQuery to call the "hello" method is
import module namespace java = 'java:my.module.MyModule';
java:hello("World!")
But is there any way to access "TITLE"?
I'd like to share some constants between XQuery and Java, and I could write accessor functions for these constants, but it'd be cleaner if I didn't have to.
Thanks!