我知道我可以在 CompositeData 中有 SimpleType 值,例如 SimpleType.INTEGER、SimpleType.STRING。但我想知道如何将 CompositeData 的另一个实例放入 CompositeData。例如:
CompositeType type = new CompositeType("My Type", "My Type", new String[]{"item1", "item2"}, new String[]{"item1", "item2"}, new OpenType[]{SimpleType.STRING, SimpleType.STRING});
CompositeData data = new CompositeDataSupport(type, new String[]{"item1", "item2"}, new String[]{"item value 1", "item value 2"});
CompositeType compType = new CompositeType("compData", "compData", new String[]{"compItem1"}, new String[]{"compItem1"}, new OpenType[]{I_DONT_KNOW_WHAT_TO_PUT_HERE});
CompositeData compData = new CompositeDataSupport(compType, new String[]{"compData"}, data);
请参阅上面的“I_DONT_KNOW_WHAT_TO_PUT_HERE”,我不知道如何传递 CompositeData 的 OpenType。我已经看到了一个从 CompositeData 递归获取嵌套 CompositeData 实例的示例。
一些参考资料:
http://docs.oracle.com/javase/6/docs/api/javax/management/openmbean/CompositeData.html http://docs.oracle.com/javase/6/docs/api/javax/management/openmbean /CompositeType.html http://docs.oracle.com/javase/6/docs/api/javax/management/openmbean/OpenType.html