Example usage for javax.management.openmbean SimpleType FLOAT

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

Introduction

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

Prototype

SimpleType FLOAT

To view the source code for javax.management.openmbean SimpleType FLOAT.

Click Source Link

Document

The SimpleType instance describing values whose Java class name is java.lang.Float.

Usage

From source file:com.adobe.acs.commons.errorpagehandler.cache.impl.ErrorPageCacheImpl.java

@SuppressWarnings("squid:S1192")
public final TabularData getCacheEntries() throws OpenDataException {

    final CompositeType cacheEntryType = new CompositeType("cacheEntry", "Cache Entry",
            new String[] { "errorPage", "hit", "miss", "hitRate", "missRate", "sizeInKB" },
            new String[] { "Error Page", "Hit", "Miss", "Hit Rate", "Miss Rate", "Size in KB" },
            new OpenType[] { SimpleType.STRING, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.FLOAT,
                    SimpleType.FLOAT, SimpleType.INTEGER });

    final TabularDataSupport tabularData = new TabularDataSupport(
            new TabularType("cacheEntries", "Cache Entries", cacheEntryType, new String[] { "errorPage" }));

    for (final Map.Entry<String, CacheEntry> entry : this.cache.entrySet()) {
        final CacheEntry cacheEntry = entry.getValue();

        final Map<String, Object> data = new HashMap<String, Object>();
        data.put("errorPage", entry.getKey());
        data.put("hit", cacheEntry.getHits());
        data.put("miss", cacheEntry.getMisses());
        data.put("hitRate", cacheEntry.getHitRate());
        data.put("missRate", cacheEntry.getMissRate());
        data.put("sizeInKB", cacheEntry.getBytes() / KB_IN_BYTES);

        tabularData.put(new CompositeDataSupport(cacheEntryType, data));
    }/*w  ww. j  a va  2s. c o  m*/

    return tabularData;
}

From source file:org.eclipse.gyrex.monitoring.internal.mbeans.MetricSetMBean.java

private OpenType detectType(final Class type) {
    if ((Long.class == type) || (Long.TYPE == type)) {
        return SimpleType.LONG;
    } else if ((Integer.class == type) || (Integer.TYPE == type)) {
        return SimpleType.INTEGER;
    } else if ((Double.class == type) || (Double.TYPE == type)) {
        return SimpleType.DOUBLE;
    } else if ((Float.class == type) || (Float.TYPE == type)) {
        return SimpleType.FLOAT;
    } else if ((Byte.class == type) || (Byte.TYPE == type)) {
        return SimpleType.BYTE;
    } else if ((Short.class == type) || (Short.TYPE == type)) {
        return SimpleType.SHORT;
    } else if ((Boolean.class == type) || (Boolean.TYPE == type)) {
        return SimpleType.BOOLEAN;
    } else if (BigDecimal.class == type) {
        return SimpleType.BIGDECIMAL;
    } else if (BigInteger.class == type) {
        return SimpleType.BIGINTEGER;
    } else if ((Character.class == type) || (Character.TYPE == type)) {
        return SimpleType.CHARACTER;
    }/*from   w  ww. j av  a2  s . com*/

    // last fallback to strings
    if (isConvertibleToString(type)) {
        return SimpleType.STRING;
    }

    // give up
    return null;
}