如何从测试包片段访问主机的实例方法/属性?
我有一个包 test.Bundle1,它具有通过蓝图注入实现的一些属性。
我创建了一个测试片段,其主机是 test.Bundle1,我想获取 myClassA 实例化单例来访问这些属性。
我知道我可以使用 FrameworkUtil.getBundle() 从类名访问包,但我不知道如何获取此类的实例。
我怎么能这么做呢?
谢谢克里斯蒂
亚诺
I have a bundle test.Bundle1 that have some properties fulfilled by Blueprint injections.
I've created one test fragment whose Host is test.Bundle1 and I would like to obtain myClassA instantiated singleton to access those properties.
I know that I could acess the bundle from a class name using FrameworkUtil.getBundle(), but I don't know how to get the instance of this class.
How could I do that?
thanks
Cristiano
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决此问题的一种方法是简单地将该实例发布为服务,以便您可以在需要它的代码中查找它。
One way to go about this is to simply publish that instance as a service, so you can look it up in code that needs it.