private TimeMachineCell[] toCells(Object cells) { WSUtils utils = WSUtils.getINSTANCE(); int size = utils.getArraySize(cells); TimeMachineCell[] result = new TimeMachineCell[size]; for (int i = 0; i < size; i++) { Object cellJson = utils.getArrayElement(cells, i); Object valuesJson = utils.getField(cellJson, "v"); Object[] resultValues = new Object[utils.getArraySize(valuesJson)]; for (int indexValue = 0; indexValue < utils.getArraySize(valuesJson); indexValue++) { Object value = utils.getArrayElement(valuesJson, indexValue); resultValues[indexValue] = value; } result[i] = new TimeMachineCell(utils.getDateTime(cellJson, "d"), resultValues); } return result; }
private TimeMachineColumn[] toColumns(Object cols) { WSUtils utils = WSUtils.getINSTANCE(); int size = utils.getArraySize(cols); TimeMachineColumn[] result = new TimeMachineColumn[size]; for (int index = 0; index < size; index++) { Object colJson = utils.getArrayElement(cols, index); result[index] = new TimeMachineColumn(index, utils.getString(colJson, "metric"), null, null); } return result; }