Example usage for javax.management.openmbean SimpleType isValue

List of usage examples for javax.management.openmbean SimpleType isValue

Introduction

In this page you can find the example usage for javax.management.openmbean SimpleType isValue.

Prototype

public boolean isValue(Object obj) 

Source Link

Document

Tests whether obj is a value for this SimpleType instance.

Usage

From source file:com.clustercontrol.jmx.factory.RunMonitorJmx.java

private Object searchTargetValue(Object value, List<Object> keys) throws Exception {
    if (value instanceof CompositeData) {
        if (keys.isEmpty())
            throw new Exception("not found value according to keys.");
        return searchTargetValue(((CompositeData) value).get(keys.get(0).toString()),
                keys.subList(1, keys.size()));
    } else if (value instanceof TabularData) {
        if (keys.isEmpty())
            throw new Exception("not found value according to keys.");
        return searchTargetValue(((TabularData) value).get((Object[]) keys.get(0)),
                keys.subList(1, keys.size()));
    } else {//from www.  j  a v a 2 s  .co  m
        for (SimpleType<?> t : validTypes) {
            if (t.isValue(value))
                return value;
        }
        throw new Exception("value type id invalid. " + value.getClass());
    }
}