@Test public void testClear() { WebPage page = WebPage.newBuilder().build(); page.setUrl(new Utf8("http: page.getParsedContent().add(new Utf8("foo")); page.getOutlinks().put(new Utf8("foo"), new Utf8("bar")); page.setContent(ByteBuffer.wrap("foo baz bar".getBytes(Charset.defaultCharset()))); page.clear(); assertNull(page.getUrl()); assertEquals(0, page.getParsedContent().size()); assertEquals(0, page.getOutlinks().size()); assertNull(page.getContent()); page.setUrl(new Utf8("http: page.getParsedContent().add(new Utf8("bar")); page.getOutlinks().put(new Utf8("bar"), new Utf8("baz")); page.setContent(ByteBuffer.wrap("foo baz bar barbaz".getBytes(Charset.defaultCharset()))); page = WebPage.newBuilder().build(); page.clear(); }
@Override public void clear() { Collection<Field> unmanagedFields = getUnmanagedFields(); for (Field field : getSchema().getFields()) { if (!unmanagedFields.contains(field)) continue; put(field.pos(), PersistentData.get().deepCopy(field.schema(), PersistentData.get().getDefaultValue(field))); } clearDirty(); }
PersistentBase extends SpecificRecordBase implements
        Persistent { @Override public void clear() { Collection<Field> unmanagedFields = getUnmanagedFields(); for (Field field : getSchema().getFields()) { if (!unmanagedFields.contains(field)) continue; put(field.pos(), PersistentData.get().deepCopy(field.schema(), PersistentData.get().getDefaultValue(field))); } clearDirty(); } }
PersistentBase extends SpecificRecordBase implements
        Persistent { @Override public void clear() { Collection<Field> unmanagedFields = getUnmanagedFields(); for (Field field : getSchema().getFields()) { if (!unmanagedFields.contains(field)) continue; put(field.pos(), PersistentData.get().deepCopy(field.schema(), PersistentData.get().getDefaultValue(field))); } clearDirty(); } PersistentBase(); }
PersistentBase extends SpecificRecordBase implements
        Persistent { @Override public void clear() { Collection<Field> unmanagedFields = getUnmanagedFields(); for (Field field : getSchema().getFields()) { if (!unmanagedFields.contains(field)) continue; put(field.pos(), PersistentData.get().deepCopy(field.schema(), PersistentData.get().getDefaultValue(field))); } clearDirty(); } PersistentBase(); abstract int getFieldsCount(); @Override void clearDirty(); @Override void clearDirty(int fieldIndex); @Override void clearDirty(String field); @Override boolean isDirty(); @Override boolean isDirty(int fieldIndex); @Override boolean isDirty(String fieldName); @Override void setDirty(); @Override void setDirty(int fieldIndex); @Override void setDirty(String field); ByteBuffer getDirtyBytes(); void setDirtyBytes(ByteBuffer __g__dirty); @Override void clear(); @Override boolean equals(Object that); @Override List<Field> getUnmanagedFields(); @Override abstract Persistent clone(); }
PersistentBase extends SpecificRecordBase implements
        Persistent { @Override public void clear() { Collection<Field> unmanagedFields = getUnmanagedFields(); for (Field field : getSchema().getFields()) { if (!unmanagedFields.contains(field)) continue; put(field.pos(), PersistentData.get().deepCopy(field.schema(), PersistentData.get().getDefaultValue(field))); } clearDirty(); } PersistentBase(); abstract int getFieldsCount(); @Override void clearDirty(); @Override void clearDirty(int fieldIndex); @Override void clearDirty(String field); @Override boolean isDirty(); @Override boolean isDirty(int fieldIndex); @Override boolean isDirty(String fieldName); @Override void setDirty(); @Override void setDirty(int fieldIndex); @Override void setDirty(String field); ByteBuffer getDirtyBytes(); void setDirtyBytes(ByteBuffer __g__dirty); @Override void clear(); @Override boolean equals(Object that); @Override List<Field> getUnmanagedFields(); @Override abstract Persistent clone();  }