Example usage for javax.management.openmbean TabularData containsKey

List of usage examples for javax.management.openmbean TabularData containsKey

Introduction

In this page you can find the example usage for javax.management.openmbean TabularData containsKey.

Prototype

public boolean containsKey(Object[] key);

Source Link

Document

Returns true if and only if this TabularData instance contains a CompositeData value (ie a row) whose index is the specified key.

Usage

From source file:org.jolokia.converter.json.TabularDataExtractor.java

private CompositeData extractCompositeDataFromPath(TabularData pTd, Stack<String> pPathStack)
        throws AttributeNotFoundException {
    // We first try it as a key
    TabularType type = pTd.getTabularType();
    List<String> indexNames = type.getIndexNames();
    checkPathFitsIndexNames(pPathStack, indexNames);

    Object keys[] = new Object[indexNames.size()];
    CompositeType rowType = type.getRowType();
    List<String> pathPartsUsed = new ArrayList<String>();
    for (int i = 0; i < indexNames.size(); i++) {
        String path = pPathStack.pop();
        pathPartsUsed.add(path);/*  ww  w.j  ava 2 s  . com*/
        keys[i] = getKey(rowType, indexNames.get(i), path);
    }
    if (pTd.containsKey(keys)) {
        return pTd.get(keys);
    } else {
        throw new AttributeNotFoundException("No entry with " + pathPartsUsed + " found");
    }
}