use of com.twosigma.beakerx.table.TableDisplay in project beakerx by twosigma.
the class TableDisplayDeSerializer method getDeserializeObject.
public static Pair<String, Object> getDeserializeObject(BeakerObjectConverter parent, JsonNode n, ObjectMapper mapper) {
Object o = null;
String subtype = null;
try {
List<List<?>> values = TableDisplayDeSerializer.getValues(parent, n, mapper);
List<String> columns = TableDisplayDeSerializer.getColumns(n, mapper);
List<String> classes = TableDisplayDeSerializer.getClasses(n, mapper);
if (n.has("subtype"))
subtype = mapper.readValue(n.get("subtype").asText(), String.class);
if (subtype != null && subtype.equals(TableDisplay.DICTIONARY_SUBTYPE)) {
o = getValuesAsDictionary(parent, n, mapper);
} else if (subtype != null && subtype.equals(TableDisplay.LIST_OF_MAPS_SUBTYPE) && columns != null && values != null) {
o = getValuesAsRows(parent, n, mapper);
} else if (subtype != null && subtype.equals(TableDisplay.MATRIX_SUBTYPE)) {
o = getValuesAsMatrix(parent, n, mapper);
}
if (o == null) {
if (n.has("hasIndex") && mapper.readValue(n.get("hasIndex").asText(), String.class).equals("true") && columns != null && values != null) {
columns.remove(0);
classes.remove(0);
for (List<?> v : values) {
v.remove(0);
}
o = new TableDisplay(values, columns, classes);
} else {
o = new TableDisplay(values, columns, classes);
}
}
} catch (Exception e) {
logger.error("exception deserializing TableDisplay ", e);
}
return new ImmutablePair<String, Object>(subtype, o);
}
Aggregations