Jython:访问单例 Java 类(静态)
我似乎无法获得完全正确的语法:我有一个 Jython 脚本和一个 Java 应用程序加载到同一个 JVM 中(用于测试)。
我需要通过 Jython 脚本中的 Singleton 类访问应用程序的特定部分。我该怎么做?
谢谢
编辑:
该设置用于自动化测试,因此假设 Jython 脚本已经可以访问 Java 应用程序的类/类路径。
假设我的 Java 应用程序有一个单例类 some.pkg.MySingleton
.. 如何从 Jython 脚本调用 MySingleton.getInstance()?
I cannot seem to get the syntax quite right for this: I have a Jython script and a Java application loaded into the same JVM (for testing).
I need to access a particular part of the application through a Singleton class from the Jython script. How do I do this?
Thanks
EDIT:
The set up is for automated testing, so assume that the Jython script already has access to the classes/classpath of the Java application.
Let's say my Java application has a singleton class some.pkg.MySingleton
.. how do I invoke MySingleton.getInstance() from my Jython script?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这没起作用吗?
如果这不起作用,请尝试以下操作:(我不确定这是否有效)
Didn't this work?
If that doesn't work, try this: (I'm not sure if this works)