Record implements Value, CopyableValue<Record> { public void clear() { if (this.numFields > 0) { this.numFields = 0; this.firstModifiedPos = 0; } } Record();  Record(Value value);  Record(Value val1, Value val2);  Record(int numFields); int getNumFields(); void setNumFields(final int numFields); void makeSpace(int numFields); @SuppressWarnings("unchecked") T getField(final int fieldNum, final Class<T> type); @SuppressWarnings("unchecked") T getField(int fieldNum, T target); boolean getFieldInto(int fieldNum, Value target); boolean getFieldsInto(int[] positions, Value[] targets); void getFieldsIntoCheckingNull(int[] positions, Value[] targets); void setField(int fieldNum, Value value); void addField(Value value); void removeField(int fieldNum); final boolean isNull(int fieldNum); void setNull(int field); void setNull(long mask); void setNull(long[] mask); void clear(); void concatenate(Record record); void unionFields(Record other); void copyTo(Record target); @Override int getBinaryLength(); @Override Record copy(); @Override void copy(DataInputView source, DataOutputView target); Record createCopy(); void copyFrom(final Record source, final int[] sourcePositions, final int[] targetPositions); final boolean equalsFields(int[] positions, Value[] searchValues, Value[] deserializationHolders); void updateBinaryRepresenation(); @Override void write(DataOutputView out); @Override void read(DataInputView in); long serialize(DataOutputView target); void deserialize(DataInputView source);  }
@Test public void testClear() throws IOException { try { Record record = new Record(new IntValue(42)); record.write(this.out); Assert.assertEquals(42, record.getField(0, IntValue.class).getValue()); record.setField(0, new IntValue(23)); record.write(this.out); Assert.assertEquals(23, record.getField(0, IntValue.class).getValue()); record.clear(); Assert.assertEquals(0, record.getNumFields()); Record record2 = new Record(new IntValue(42)); record2.read(in); Assert.assertEquals(42, record2.getField(0, IntValue.class).getValue()); record2.read(in); Assert.assertEquals(23, record2.getField(0, IntValue.class).getValue()); } catch (Throwable t) { Assert.fail("Test failed due to an exception: " + t.getMessage()); } }