當前位置: 首頁>>代碼示例>>Java>>正文


Java ObjectName.getKeyPropertyListString方法代碼示例

本文整理匯總了Java中javax.management.ObjectName.getKeyPropertyListString方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectName.getKeyPropertyListString方法的具體用法?Java ObjectName.getKeyPropertyListString怎麽用?Java ObjectName.getKeyPropertyListString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.management.ObjectName的用法示例。


在下文中一共展示了ObjectName.getKeyPropertyListString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getKeyPropertyList

import javax.management.ObjectName; //導入方法依賴的package包/類
static LinkedHashMap<String, String> getKeyPropertyList(ObjectName mbeanName) {
    // Implement a version of ObjectName.getKeyPropertyList that returns the
    // properties in the ordered they were added (the ObjectName stores them
    // in the order they were added).
    LinkedHashMap<String, String> output = new LinkedHashMap<String, String>();
    String properties = mbeanName.getKeyPropertyListString();
    Matcher match = PROPERTY_PATTERN.matcher(properties);
    while (match.lookingAt()) {
        output.put(match.group(1), match.group(2));
        properties = properties.substring(match.end());
        if (properties.startsWith(",")) {
            properties = properties.substring(1);
        }
        match.reset(properties);
    }
    return output;
}
 
開發者ID:flokkr,項目名稱:jmxpromo,代碼行數:18,代碼來源:JmxScraper.java

示例2: initChildObjectNameParts

import javax.management.ObjectName; //導入方法依賴的package包/類
/**
 * TODO: Comment.
 * 
 */
private void initChildObjectNameParts() {

    _ChildObjectNameKeyValues = new ArrayList<ObjectNameKeyValue>();
    _ObjectNameKeyValueMap = new HashMap<String, ObjectNameKeyValue>();
    _MBeanObjectNameKeyValueMap = new HashMap<ObjectName, ObjectNameKeyValue>();

    if (_MBeanObjectNames == null) {
        return;
    }

    for (ObjectName objectName : _MBeanObjectNames) {

        ObjectNameKeyValue parentObjectNameKeyValue = null;
        String keyPropertyListString = objectName.getKeyPropertyListString();
        String[] keyValuePairStrings = keyPropertyListString.split(",");
        int keyValuePairCount = keyValuePairStrings.length;
        for (int i = 0; i < keyValuePairCount; i++) {

            String keyValuePairString = keyValuePairStrings[i];

            String[] keyValuePair = keyValuePairString.split("=");
            String key = keyValuePair[0];

            if (_ObjectNameKeyValueMap.containsKey(keyValuePairString)) {
                parentObjectNameKeyValue = _ObjectNameKeyValueMap.get(keyValuePairString);
                continue;
            }

            boolean isMBean = false;
            if (i == keyValuePairCount - 1) {
                isMBean = true;
            }

            IObjectNamePart parentObjectNamePart = this;
            List<ObjectNameKeyValue> childParts = _ChildObjectNameKeyValues;
            if (parentObjectNameKeyValue != null) {
                parentObjectNamePart = parentObjectNameKeyValue;
                childParts = parentObjectNameKeyValue.getChildObjectNameKeyValues();
            }

            ObjectNameKeyValue objectNameKeyValue = new ObjectNameKeyValue(objectName, isMBean, key,
                    parentObjectNamePart);
            childParts.add(objectNameKeyValue);

            _ObjectNameKeyValueMap.put(keyValuePairString, objectNameKeyValue);
            if (isMBean) {
                _MBeanObjectNameKeyValueMap.put(objectName, objectNameKeyValue);
            }
            parentObjectNameKeyValue = objectNameKeyValue;

        }

    }

}
 
開發者ID:baloise,項目名稱:eZooKeeper,代碼行數:60,代碼來源:Domain.java


注:本文中的javax.management.ObjectName.getKeyPropertyListString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。