Rhino 编译器的编程接口?
我找到了 Rhino JS Compiler 文档,其中说明了如何编译 JS -> JVM,但我发现的唯一有记录的接口是命令行工具的接口。另外,它似乎是为“脚本(命令列表)”构建的 -> “可运行的 Main() 方法”用例,而不是(例如)对特定 Java 类进行子类化。
有没有一种简单的方法可以使用Rhino代码生成器为我定义的类生成.class文件?具体来说,我正在尝试实现一个与 Java 库一起使用的接口,该库将反过来并对其进行检查,因此在 Rhino 中实现接口的正常解释器机制在这里不起作用。
I've found Rhino JS Compiler documentation, which says how to compile JS -> JVM, but the only documented interface I've found is for the command-line tool. Also, it seems to be built for the "script (list of commands)" -> "runnable Main() method" use case, and not (for example) subclassing a specific Java class.
Is there an easy way to use the Rhino code generator to generate a .class file for a class I define? Specifically, I'm trying to implement an interface for use with a Java library that will turn around and use inspection on it, so the normal interpreter mechanism of implementing an interface in Rhino won't work here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不熟悉 Rhino 的这些细节,但是 javax.script 上的 Java 文档有一个非常简单的部分,标题为 实现 Java 接口。也许这会有所帮助。
I am not familiar with these specifics of Rhino, but the Java documentation on javax.script has a very straightforward section titled Implementing Java Interfaces. Perhaps this will be helpful.