@Test public void testClear() { WebPage page = new WebPage(); page.setUrl(new Utf8("http: page.addToParsedContent(new Utf8("foo")); page.putToOutlinks(new Utf8("foo"), new Utf8("bar")); page.setContent(ByteBuffer.wrap("foo baz bar".getBytes())); page.clear(); Assert.assertNull(page.getUrl()); Assert.assertEquals(0, page.getParsedContent().size()); Assert.assertEquals(0, page.getOutlinks().size()); Assert.assertNull(page.getContent()); page.setUrl(new Utf8("http: page.addToParsedContent(new Utf8("bar")); page.putToOutlinks(new Utf8("bar"), new Utf8("baz")); page.setContent(ByteBuffer.wrap("foo baz bar barbaz".getBytes())); page = new WebPage(); page.clear(); Employee employee = new Employee(); employee.clear(); }
@Override @SuppressWarnings("rawtypes") public void clear() { List<Field> fields = getSchema().getFields(); for(int i=0; i<getFields().length; i++) { switch(fields.get(i).schema().getType()) { case MAP: if(get(i) != null) ((Map)get(i)).clear(); break; case ARRAY: if(get(i) != null) { if(get(i) instanceof ListGenericArray) { ((ListGenericArray)get(i)).clear(); } else { put(i, new ListGenericArray(fields.get(i).schema())); } } break; case RECORD : Persistent field = ((Persistent)get(i)); if(field != null) field.clear(); break; case BOOLEAN: put(i, false); break; case INT : put(i, 0); break; case DOUBLE : put(i, 0d); break; case FLOAT : put(i, 0f); break; case LONG : put(i, 0l); break; case NULL : break; default : put(i, null); break; } } clearDirty(); clearReadable(); }
PersistentBase implements Persistent { @Override @SuppressWarnings("rawtypes") public void clear() { List<Field> fields = getSchema().getFields(); for(int i=0; i<getFields().length; i++) { switch(fields.get(i).schema().getType()) { case MAP: if(get(i) != null) ((Map)get(i)).clear(); break; case ARRAY: if(get(i) != null) { if(get(i) instanceof ListGenericArray) { ((ListGenericArray)get(i)).clear(); } else { put(i, new ListGenericArray(fields.get(i).schema())); } } break; case RECORD : Persistent field = ((Persistent)get(i)); if(field != null) field.clear(); break; case BOOLEAN: put(i, false); break; case INT : put(i, 0); break; case DOUBLE : put(i, 0d); break; case FLOAT : put(i, 0f); break; case LONG : put(i, 0l); break; case NULL : break; default : put(i, null); break; } } clearDirty(); clearReadable(); } }
PersistentBase implements Persistent { @Override @SuppressWarnings("rawtypes") public void clear() { List<Field> fields = getSchema().getFields(); for(int i=0; i<getFields().length; i++) { switch(fields.get(i).schema().getType()) { case MAP: if(get(i) != null) ((Map)get(i)).clear(); break; case ARRAY: if(get(i) != null) { if(get(i) instanceof ListGenericArray) { ((ListGenericArray)get(i)).clear(); } else { put(i, new ListGenericArray(fields.get(i).schema())); } } break; case RECORD : Persistent field = ((Persistent)get(i)); if(field != null) field.clear(); break; case BOOLEAN: put(i, false); break; case INT : put(i, 0); break; case DOUBLE : put(i, 0d); break; case FLOAT : put(i, 0f); break; case LONG : put(i, 0l); break; case NULL : break; default : put(i, null); break; } } clearDirty(); clearReadable(); } protected  PersistentBase(); protected  PersistentBase(StateManager stateManager); }
PersistentBase implements Persistent { @Override @SuppressWarnings("rawtypes") public void clear() { List<Field> fields = getSchema().getFields(); for(int i=0; i<getFields().length; i++) { switch(fields.get(i).schema().getType()) { case MAP: if(get(i) != null) ((Map)get(i)).clear(); break; case ARRAY: if(get(i) != null) { if(get(i) instanceof ListGenericArray) { ((ListGenericArray)get(i)).clear(); } else { put(i, new ListGenericArray(fields.get(i).schema())); } } break; case RECORD : Persistent field = ((Persistent)get(i)); if(field != null) field.clear(); break; case BOOLEAN: put(i, false); break; case INT : put(i, 0); break; case DOUBLE : put(i, 0d); break; case FLOAT : put(i, 0f); break; case LONG : put(i, 0l); break; case NULL : break; default : put(i, null); break; } } clearDirty(); clearReadable(); } protected  PersistentBase(); protected  PersistentBase(StateManager stateManager); @Override StateManager getStateManager(); @Override String[] getFields(); @Override String getField(int index); @Override int getFieldIndex(String field); @Override @SuppressWarnings("rawtypes") void clear(); @Override boolean isNew(); @Override void setNew(); @Override void clearNew(); @Override boolean isDirty(); @Override boolean isDirty(int fieldIndex); @Override boolean isDirty(String field); @Override void setDirty(); @Override void setDirty(int fieldIndex); @Override void setDirty(String field); @Override void clearDirty(int fieldIndex); @Override void clearDirty(String field); @Override void clearDirty(); @Override boolean isReadable(int fieldIndex); @Override boolean isReadable(String field); @Override void setReadable(int fieldIndex); @Override void setReadable(String field); @Override void clearReadable(); @Override void clearReadable(int fieldIndex); @Override void clearReadable(String field); @Override boolean equals(Object o); @Override int hashCode(); @Override Persistent clone(); @Override String toString(); }
PersistentBase implements Persistent { @Override @SuppressWarnings("rawtypes") public void clear() { List<Field> fields = getSchema().getFields(); for(int i=0; i<getFields().length; i++) { switch(fields.get(i).schema().getType()) { case MAP: if(get(i) != null) ((Map)get(i)).clear(); break; case ARRAY: if(get(i) != null) { if(get(i) instanceof ListGenericArray) { ((ListGenericArray)get(i)).clear(); } else { put(i, new ListGenericArray(fields.get(i).schema())); } } break; case RECORD : Persistent field = ((Persistent)get(i)); if(field != null) field.clear(); break; case BOOLEAN: put(i, false); break; case INT : put(i, 0); break; case DOUBLE : put(i, 0d); break; case FLOAT : put(i, 0f); break; case LONG : put(i, 0l); break; case NULL : break; default : put(i, null); break; } } clearDirty(); clearReadable(); } protected  PersistentBase(); protected  PersistentBase(StateManager stateManager); @Override StateManager getStateManager(); @Override String[] getFields(); @Override String getField(int index); @Override int getFieldIndex(String field); @Override @SuppressWarnings("rawtypes") void clear(); @Override boolean isNew(); @Override void setNew(); @Override void clearNew(); @Override boolean isDirty(); @Override boolean isDirty(int fieldIndex); @Override boolean isDirty(String field); @Override void setDirty(); @Override void setDirty(int fieldIndex); @Override void setDirty(String field); @Override void clearDirty(int fieldIndex); @Override void clearDirty(String field); @Override void clearDirty(); @Override boolean isReadable(int fieldIndex); @Override boolean isReadable(String field); @Override void setReadable(int fieldIndex); @Override void setReadable(String field); @Override void clearReadable(); @Override void clearReadable(int fieldIndex); @Override void clearReadable(String field); @Override boolean equals(Object o); @Override int hashCode(); @Override Persistent clone(); @Override String toString();  }