use of com.palantir.atlasdb.table.description.DynamicColumnDescription in project atlasdb by palantir.
the class TableMetadataDeserializer method deserializeDynamicCol.
private ColumnMetadataDescription deserializeDynamicCol(JsonNode node) {
NameMetadataDescription col = deserializeRowish(node.get("column"));
ColumnValueDescription val = deserializeValue(node.get("value"));
DynamicColumnDescription dynamicCol = new DynamicColumnDescription(col, val);
return new ColumnMetadataDescription(dynamicCol);
}
use of com.palantir.atlasdb.table.description.DynamicColumnDescription in project atlasdb by palantir.
the class TableCellValSerializer method serialize.
private static void serialize(JsonGenerator jgen, TableMetadata metadata, Entry<Cell, byte[]> result) throws IOException {
Cell cell = result.getKey();
byte[] row = cell.getRowName();
byte[] col = cell.getColumnName();
byte[] val = result.getValue();
jgen.writeStartObject();
AtlasSerializers.serializeRow(jgen, metadata.getRowMetadata(), row);
ColumnMetadataDescription columns = metadata.getColumns();
if (columns.hasDynamicColumns()) {
DynamicColumnDescription dynamicColumn = columns.getDynamicColumn();
AtlasSerializers.serializeDynamicColumn(jgen, dynamicColumn, col);
jgen.writeFieldName("val");
AtlasSerializers.serializeVal(jgen, dynamicColumn.getValue(), val);
} else {
String shortName = PtBytes.toString(col);
Set<NamedColumnDescription> namedColumns = columns.getNamedColumns();
for (NamedColumnDescription description : namedColumns) {
if (shortName.equals(description.getShortName())) {
AtlasSerializers.serializeNamedCol(jgen, description, val);
break;
}
}
}
jgen.writeEndObject();
}
Aggregations