本文整理汇总了Java中javax.management.openmbean.CompositeDataSupport.getCompositeType方法的典型用法代码示例。如果您正苦于以下问题:Java CompositeDataSupport.getCompositeType方法的具体用法?Java CompositeDataSupport.getCompositeType怎么用?Java CompositeDataSupport.getCompositeType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.management.openmbean.CompositeDataSupport
的用法示例。
在下文中一共展示了CompositeDataSupport.getCompositeType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapAttribute
import javax.management.openmbean.CompositeDataSupport; //导入方法依赖的package包/类
@Override
public Optional<Map<String, Object>> mapAttribute(final Object value) {
if (value == null) {
return Optional.absent();
}
Util.checkType(value, CompositeDataSupport.class);
CompositeDataSupport compositeData = (CompositeDataSupport) value;
CompositeType currentType = compositeData.getCompositeType();
CompositeType expectedType = getOpenType();
Set<String> expectedCompositeTypeKeys = expectedType.keySet();
Set<String> currentCompositeTypeKeys = currentType.keySet();
Preconditions.checkArgument(expectedCompositeTypeKeys.equals(currentCompositeTypeKeys),
"Composite type mismatch, expected composite type with attributes " + expectedCompositeTypeKeys
+ " but was " + currentCompositeTypeKeys);
Map<String, Object> retVal = Maps.newHashMap();
for (String jmxName : jmxToJavaNameMapping.keySet()) {
Optional<?> mapped = mapInnerAttribute(compositeData, jmxName, expectedType.getDescription(jmxName));
if (mapped.isPresent()) {
retVal.put(jmxToJavaNameMapping.get(jmxName), mapped.get());
}
}
return Optional.of(retVal);
}
示例2: report
import javax.management.openmbean.CompositeDataSupport; //导入方法依赖的package包/类
private void report(final CompositeDataSupport data, final PrintStream out) {
CompositeType type = data.getCompositeType();
out.print(',');
for (Iterator it = type.keySet().iterator(); it.hasNext();) {
String key = (String) it.next();
if (data.containsKey(key))
out.print(key + '=' + data.get(key));
if (it.hasNext())
out.print(';');
}
}
示例3: writeJmx
import javax.management.openmbean.CompositeDataSupport; //导入方法依赖的package包/类
/**
* Write to JMX.
*
* @param type
* the type
* @param key
* the key
* @param value
* the value
* @throws AttributeNotFoundException
* the attribute not found exception
* @throws MBeanException
* the MBean exception
* @throws ReflectionException
* the reflection exception
* @throws InvalidAttributeValueException
* the invalid attribute value exception
* @throws OpenDataException
* the open data exception
*/
private void writeJmx(String type, String key, long value) throws AttributeNotFoundException, MBeanException,
ReflectionException, InvalidAttributeValueException, OpenDataException {
final CompositeDataSupport composite = (CompositeDataSupport) reporter.getAttribute(type);
final CompositeType compositeType = composite.getCompositeType();
final String[] keys = composite.getCompositeType().keySet().toArray(new String[] {});
final HashMap<String, Object> map = new HashMap<>();
for (String k : keys) {
if (k == key) {
map.put(k, value);
} else {
map.put(k, composite.get(k));
}
}
reporter.setAttribute(new Attribute(type, new CompositeDataSupport(compositeType, map)));
}
示例4: coreCompositeTypeToJMSCompositeType
import javax.management.openmbean.CompositeDataSupport; //导入方法依赖的package包/类
public static CompositeData coreCompositeTypeToJMSCompositeType(CompositeDataSupport data) throws Exception {
CompositeData jmsdata = new CompositeDataSupport(data.getCompositeType(), new HashMap<String, Object>());
return jmsdata;
}