List of usage examples for javax.management.openmbean ArrayType getElementOpenType
public OpenType<?> getElementOpenType()
From source file:org.jolokia.converter.object.ArrayTypeConverter.java
/** {@inheritDoc} */ @Override/* w w w. j a va 2 s . co m*/ public Object convertToObject(ArrayType type, Object pFrom) { JSONAware value = toJSON(pFrom); // prepare each value in the array and then process the array of values if (!(value instanceof JSONArray)) { throw new IllegalArgumentException("Can not convert " + value + " to type " + type + " because JSON object type " + value.getClass() + " is not a JSONArray"); } JSONArray jsonArray = (JSONArray) value; OpenType elementOpenType = type.getElementOpenType(); Object[] valueArray = createTargetArray(elementOpenType, jsonArray.size()); int i = 0; for (Object element : jsonArray) { valueArray[i++] = getDispatcher().convertToObject(elementOpenType, element); } return valueArray; }