CompositeData没有keys()方法?
我正在使用 JMX 保存来自远程进程的一些诊断信息。 查看jconsole中的接口显示返回类型为 CompositeData (数据实际上返回为 复合数据支持)。 我想输出与该对象关联的所有键/值对。
问题是该接口似乎只有一个“values()”方法,无法获取键。 我在这里错过了什么吗? 还有其他方法可以完成这项任务吗?
谢谢!
I'm using JMX to save some diagnostic information from a remote process. Looking at the interface in jconsole shows that the return type is CompositeData (the data actually comes back as CompositeDataSupport). I want to output all the key/value pairs that are associated with this object.
The problem is that the interface just seems to have a "values()" method with no way of getting the keys. Am I missing something here? Is there some other way to approach this task?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我没有记错的话,你可以这样做
(假设 cData 是一个 CompositeData 对象)
http://java.sun.com/j2se/1.5.0/docs/api/javax/management/openmbean/CompositeType.html#keySet()
If I'm not mistaken you could do
(given that cData is a CompositeData object)
http://java.sun.com/j2se/1.5.0/docs/api/javax/management/openmbean/CompositeType.html#keySet()
您可以通过这个打印所有 JVM MBean 属性的小程序找到更完整的示例
特别是:
部分:
成为你所追求的。
You can find a more complete example with this small program that prints the attributes of all JVM MBeans
In particular:
The part:
being what you are after.