RecordSerializer { @SuppressFBWarnings("RV_RETURN_VALUE_IGNORED") public static Map<String, Object> toBean(Record record, Table table) { try { ImmutableMap.Builder<String, Object> res = new ImmutableMap.Builder<>(); if (table.primaryKey.length == 1) { Object key = deserializeSingleColumnPrimaryKey(record.key, table); res.put(table.primaryKey[0], key); } else { deserializeMultiColumnPrimaryKey(record.key, table, res); } if (record.value != null && record.value.getLength() > 0) { try (ByteArrayCursor din = record.value.newCursor()) { while (true) { int serialPosition; serialPosition = din.readVIntNoEOFException(); if (din.isEof()) { break; } Column col = table.getColumnBySerialPosition(serialPosition); if (col != null) { Object v = deserializeTypeAndValue(din); res.put(col.name, v); } else { skipTypeAndValue(din); } } } } return res.build(); } catch (IOException err) { throw new IllegalArgumentException("malformed record", err); } } private  RecordSerializer(); static Object deserialize(Bytes data, int type); static Object deserialize(byte[] data, int type); static int deserializeCompare(byte[] data, int type, Object cvalue); static SQLRecordPredicateFunctions.CompareResult deserializeCompare(Bytes data, int type, Object cvalue); static Object deserializeTypeAndValue(ByteArrayCursor dii); static SQLRecordPredicateFunctions.CompareResult compareDeserializeTypeAndValue(ByteArrayCursor dii, Object cvalue); static void skipTypeAndValue(ByteArrayCursor dii); static byte[] serialize(Object v, int type); static void serializeTo(Object v, int type, ExtendedDataOutputStream out); static void validate(Object v, int type); static void serializeTypeAndValue(Object v, int type, ExtendedDataOutputStream oo); static void serializeValue(Object v, int type, ExtendedDataOutputStream oo); static DateTimeFormatter getUTCTimestampFormatter(); static Object convert(int type, Object value); static DataAccessor buildRawDataAccessor(Record record, Table table); static DataAccessor buildRawDataAccessorForPrimaryKey(Bytes key, Table table); static Record makeRecord(Table table, Object... values); static Bytes serializePrimaryKey(Map<String, Object> record, ColumnsList table, String[] columns); static byte[] serializePrimaryKeyRaw(Map<String, Object> record, ColumnsList table, String[] columns); static Bytes serializeIndexKey(DataAccessor record, ColumnsList index, String[] columns); static void validateIndexableValue(DataAccessor record, ColumnsList indexDefinition, String[] columns); static Object deserializePrimaryKey(Bytes key, Table table); static Map<String, Object> deserializePrimaryKeyAsMap(Bytes key, Table table); static Bytes serializeValue(Map<String, Object> record, Table table); static byte[] serializeValueRaw(Map<String, Object> record, Table table, int expectedSize); static byte[] buildRecord(
            int expectedSize, Table table,
            Function<String, Object> evaluator
    ); static Record toRecord(Map<String, Object> record, Table table); @SuppressFBWarnings("RV_RETURN_VALUE_IGNORED") static Map<String, Object> toBean(Record record, Table table);  }
@Test public void testToBean() { Table table = Table.builder() .name("t1") .column("pk", ColumnTypes.STRING) .column("a", ColumnTypes.STRING) .column("b", ColumnTypes.LONG) .column("c", ColumnTypes.INTEGER) .column("d", ColumnTypes.TIMESTAMP) .column("e", ColumnTypes.BYTEARRAY) .primaryKey("pk") .build(); Record record = RecordSerializer.makeRecord(table, "pk", "a", "a", "test", "b", 1L, "c", 2, "d", new java.sql.Timestamp(System.currentTimeMillis()), "e", "foo".getBytes(StandardCharsets.UTF_8)); Map<String, Object> toBean = RecordSerializer.toBean(record, table); }