DefaultSampleListener.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:tnt4j-stream-jmx 作者:
/**
 * Process/extract value from a given MBean attribute
 *
 * @param snapshot instance where extracted attribute is stored
 * @param mbAttrInfo MBean attribute info
 * @param propName name to be assigned to given attribute value
 * @param value associated with attribute
 * @return snapshot instance where all attributes are contained
 */
protected PropertySnapshot processAttrValue(PropertySnapshot snapshot, MBeanAttributeInfo mbAttrInfo,
        PropertyNameBuilder propName, Object value) {
    if (value instanceof CompositeData) {
        CompositeData cdata = (CompositeData) value;
        Set<String> keys = cdata.getCompositeType().keySet();
        for (String key : keys) {
            Object cVal = cdata.get(key);
            processAttrValue(snapshot, mbAttrInfo, propName.append(key), cVal);
            propName.popLevel();
        }
    } else if (value instanceof TabularData) {
        TabularData tData = (TabularData) value;
        Collection<?> values = tData.values();
        int row = 0;
        for (Object tVal : values) {
            processAttrValue(snapshot, mbAttrInfo, propName.append(padNumber(++row)), tVal);
            propName.popLevel();
        }
    } else {
        snapshot.add(propName.propString(), value);
    }
    return snapshot;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号