Annotation Interface HostAccess.Export

Enclosing class:

@Target({CONSTRUCTOR,FIELD,METHOD}) @Retention(RUNTIME) public static @interface HostAccess.Export
Annotation used by the predefined HostAccess.EXPLICIT access policy to mark public constructors, methods and fields in public classes that should be accessible by the guest application.

Example using a Java object from JavaScript:

 public class JavaRecord {
     @HostAccess.Export public int x;

     public String name() {
         return "foo";
 try (Context context = Context.create()) {
     JavaRecord record = new JavaRecord();
     context.getBindings("js").putMember("javaRecord", record);
     context.eval("js", "javaRecord.x = 42");
     context.eval("js", "").asString().equals("foo");
See Also: