本文整理匯總了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;
}
示例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;
}
}
}