Example usage for javax.management.openmbean CompositeType getDescription

List of usage examples for javax.management.openmbean CompositeType getDescription

Introduction

In this page you can find the example usage for javax.management.openmbean CompositeType getDescription.

Prototype

public String getDescription(String itemName) 

Source Link

Document

Returns the description of the item whose name is itemName, or null if this CompositeType instance does not define any item whose name is itemName.

Usage

From source file:com.appleframework.jmx.core.services.MBeanServiceImpl.java

/**
 * Expands a CompositeData object into individual attributes with the
 * naming convention:/*from  w  w w.  j av a  2s .co  m*/
 * <p>
 * attributeName.itemName
 * <p>
 * The items should conform to given "dataType" array. These individual
 * attributes are added to the <code>attributeList</code>
 * @param attributesList    ObjectAttributeInfo instances are added to this
 *                          list
 */
private void handleCompositeData(ServerConnection connection, ObjectName objectName,
        ObjectAttributeInfo attrInfo, String[] dataTypes, List<ObjectAttributeInfo> attributesList) {

    CompositeType type = getCompositeType(connection, objectName, attrInfo);
    for (Iterator<?> it = type.keySet().iterator(); it.hasNext();) {
        String itemName = (String) it.next();
        OpenType<?> itemType = type.getType(itemName);
        Class<?> itemTypeClass = getClass(itemType.getClassName(), this.getClass().getClassLoader());
        for (int j = 0; j < dataTypes.length; j++) {
            Class<?> dataType = getClass(dataTypes[j], this.getClass().getClassLoader());
            if (dataType.isAssignableFrom(itemTypeClass)) {
                attributesList
                        .add(new ObjectAttributeInfo(attrInfo.getName() + COMPOSITE_ATTR_SEPARATOR + itemName,
                                type.getDescription(itemName), itemType.getClassName(), false, true, false));
            }
        }
    }
}