Java – CompositeData has no keys() method

diagnosticsjavajconsolejmx

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!

Best Solution

If I'm not mistaken you could do

Set< String > keys = cData.getCompositeType().keySet();

(given that cData is a CompositeData object)

http://java.sun.com/j2se/1.5.0/docs/api/javax/management/openmbean/CompositeType.html#keySet()