简体   繁体   English

Java +脚本引擎:JSR223 +类似替代品之间的差异

[英]Java + scripting engines: differences between JSR223 + similar alternatives

I've started to run into some really annoying problems using JSR223's interfaces to Rhino: 我已经开始使用JSR223的Rhino接口遇到一些非常恼人的问题:

  • poor exception information (see my other SO question ) 可怜的异常信息(参见我的其他SO问题
  • inability to use ScriptableObject (it would be nice to set the Javascript foo variable to a Javascript value with properties so that I can set foo.bar to something and foo.baz to something else. JSR223 just lets me set root global variables to Java values.) 无法使用ScriptableObject (将Javascript foo变量设置为具有属性的Javascript值会很好,这样我就可以将foo.bar设置为某些内容并将foo.baz为其他内容.JSR223只允许我将根全局变量设置为Java值。)
  • 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. 如果有必要,我会考虑切换到Rhino作为本机脚本引擎,但是如果没有额外的努力就无法支持其他语言。

Is there any better abstraction layer besides JSR223? 除了JSR223之外还有更好的抽象层吗?

I've heard of Bean Scripting Framework but am not sure how it's different/worse/better. 我听说过Bean Scripting Framework,但我不确定它是如何不同/更差/更好。 I also ran across Scripturian and have no idea about that. 我也跑过了Scripturian并且对此一无所知。

Not really an answer, but from my humble limited exploration jsr223 and bsf are rather simple and do not really address more powerful embedding. 不是一个真正的答案,但从我简陋的有限探索jsr223和bsf相当简单,并没有真正解决更强大的嵌入。 If you really want better integration you need to use the native bridge. 如果您真的想要更好的集成,则需要使用本机桥。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM