本文整理汇总了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;
}
}
}