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; }
protected TimeMachine parse(Object json) { WSUtils utils = WSUtils.getINSTANCE(); Object cols = utils.getField(json, "cols"); Object cells = utils.getField(json, "cells"); return new TimeMachine(toColumns(cols), toCells(cells)); }