Java +脚本引擎:JSR223 和#x2B; 之间的差异类似的替代品
我开始在使用 JSR223 的 Rhino 接口时遇到一些非常烦人的问题:
- 异常信息很差(请参阅 我的其他问题)
- 无法使用 ScriptableObject (最好将 Javascript
foo
变量设置为具有属性的 Javascript 值,这样我就可以将foo.bar
设置为某些内容和foo.baz
为其他东西,JSR223 只是让我将根全局变量设置为 Java 值。) - 无法设置只读变量/属性
如果有必要,我会考虑切换到 Rhino 作为本机。脚本引擎,但随之而来的是如果不付出大量额外努力就无法支持其他语言的痛苦。
除了JSR223还有更好的抽象层吗?
我听说过 Bean 脚本框架,但不确定它有何不同/更差/更好。我还遇到了 Scripturian ,但对此一无所知。
I've started to run into some really annoying problems using JSR223's interfaces to Rhino:
- poor exception information (see my other SO question)
- inability to use ScriptableObject (it would be nice to set the Javascript
foo
variable to a Javascript value with properties so that I can setfoo.bar
to something andfoo.baz
to something else. JSR223 just lets me set root global variables to Java values.) - inability to set read-only variables/properties
If necessary, I'd consider switching to Rhino as a native scripting engine, but that comes with the pain of not being able to support other languages without a bunch of extra effort.
Is there any better abstraction layer besides JSR223?
I've heard of Bean Scripting Framework but am not sure how it's different/worse/better. I also ran across Scripturian and have no idea about that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这并不是一个真正的答案,但从我谦虚的有限探索来看,jsr223 和 bsf 相当简单,并没有真正解决更强大的嵌入问题。如果您确实想要更好的集成,您需要使用本机桥。
Not really an answer, but from my humble limited exploration jsr223 and bsf are rather simple and do not really address more powerful embedding. If you really want better integration you need to use the native bridge.