Schema implements ProtoObject<SchemaProto>, Cloneable, GsonObject { @Override public Object clone() throws CloneNotSupportedException { Schema schema = (Schema) super.clone(); schema.init(); for(Column column: this.fields) { schema.addColumn(column); } return schema; } Schema();  Schema(SchemaProto proto);  Schema(Schema schema);  Schema(Column [] columns);  Schema(Iterable<Column> columns); void setQualifier(String qualifier); int size(); Column getColumn(int id); Column getColumn(Column column); int getIndex(Column column); Column getColumn(String name); int getColumnId(String name); int getColumnIdByName(String colName); List<Column> getRootColumns(); List<Column> getAllColumns(); boolean contains(String name); boolean contains(Column column); boolean containsByQualifiedName(String qualifiedName); boolean containsByName(String colName); boolean containsAll(Collection<Column> columns); synchronized Schema addColumn(String name, TypeDesc typeDesc); synchronized Schema addColumn(String name, Type type); synchronized Schema addColumn(String name, Type type, int length); synchronized Schema addColumn(String name, DataType dataType); synchronized void addColumn(Column column); synchronized void addColumns(Schema schema); @Override int hashCode(); @Override boolean equals(Object o); @Override Object clone(); @Override SchemaProto getProto(); String toString(); @Override String toJson(); Column [] toArray();  }
@Test public final void testClone() throws CloneNotSupportedException { Schema schema = new Schema(); schema.addColumn("abc", Type.FLOAT8); schema.addColumn("bbc", Type.FLOAT8); Schema schema2 = new Schema(schema.getProto()); assertEquals(schema.getProto(), schema2.getProto()); assertEquals(schema.getColumn(0), schema2.getColumn(0)); assertEquals(schema.size(), schema2.size()); Schema schema3 = (Schema) schema.clone(); assertEquals(schema.getProto(), schema3.getProto()); assertEquals(schema.getColumn(0), schema3.getColumn(0)); assertEquals(schema.size(), schema3.size()); }