public Object clone() {
    Preconditions.checkState( fieldStream.length == fieldDatabase.length,
      "Table fields and stream fields are not of equal length." );
    TableOutputMeta retval = (TableOutputMeta) super.clone();
    int nrRows = fieldStream.length;
    retval.allocate( nrRows );
    System.arraycopy( fieldStream, 0, retval.fieldStream, 0, nrRows );
    System.arraycopy( fieldDatabase, 0, retval.fieldDatabase, 0, nrRows );

    return retval;
  }
@Test
  public void testClone() throws Exception {
    TableOutputMeta tableOutputMeta = new TableOutputMeta();
    tableOutputMeta.setDefault();
    tableOutputMeta.setFieldStream( new String[] {"1", "2", "3"} );
    tableOutputMeta.setFieldDatabase( new String[] {"d1", "d2", "d3"} );
    TableOutputMeta clone = (TableOutputMeta) tableOutputMeta.clone();
    assertNotSame( clone, tableOutputMeta );
    assertEquals( clone.getXML(), tableOutputMeta.getXML() );
  }