Search in sources :

Example 1 with CompositeDataView

use of javax.management.openmbean.CompositeDataView in project geode by apache.

the class CompositeConverter method toNonNullOpenValue.

/**
   * Converts to open value
   */
Object toNonNullOpenValue(Object value) throws OpenDataException {
    CompositeType ct = (CompositeType) getOpenType();
    if (value instanceof CompositeDataView)
        return ((CompositeDataView) value).toCompositeData(ct);
    if (value == null)
        return null;
    Object[] values = new Object[getters.length];
    for (int i = 0; i < getters.length; i++) {
        try {
            Object got = getters[i].invoke(value, (Object[]) null);
            values[i] = getterConverters[i].toOpenValue(got);
        } catch (Exception e) {
            throw openDataException("Error calling getter for " + itemNames[i] + ": " + e, e);
        }
    }
    return new CompositeDataSupport(ct, itemNames, values);
}
Also used : CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) CompositeDataView(javax.management.openmbean.CompositeDataView) OpenDataException(javax.management.openmbean.OpenDataException) InvalidObjectException(java.io.InvalidObjectException) CompositeType(javax.management.openmbean.CompositeType)

Aggregations

InvalidObjectException (java.io.InvalidObjectException)1 CompositeDataSupport (javax.management.openmbean.CompositeDataSupport)1 CompositeDataView (javax.management.openmbean.CompositeDataView)1 CompositeType (javax.management.openmbean.CompositeType)1 OpenDataException (javax.management.openmbean.OpenDataException)1