1 package org.dbunit.dataset; 2 3 9 public class EmptyTableDataSet extends AbstractDataSet 10 { 11 private final IDataSet _dataSet; 12 13 public EmptyTableDataSet(IDataSet dataSet) 14 { 15 _dataSet = dataSet; 16 } 17 18 21 public String [] getTableNames() throws DataSetException 22 { 23 return _dataSet.getTableNames(); 24 } 25 26 public ITableMetaData getTableMetaData(String tableName) throws DataSetException 27 { 28 return _dataSet.getTableMetaData(tableName); 29 } 30 31 public ITable getTable(String tableName) throws DataSetException 32 { 33 return new DefaultTable(_dataSet.getTableMetaData(tableName)); 34 } 35 36 39 protected ITableIterator createIterator(boolean reversed) throws DataSetException 40 { 41 return new EmptyTableIterator(reversed ? 42 _dataSet.reverseIterator() : _dataSet.iterator()); 43 } 44 45 public static class EmptyTableIterator implements ITableIterator 46 { 47 private final ITableIterator _iterator; 48 49 public EmptyTableIterator(ITableIterator iterator) 50 { 51 _iterator = iterator; 52 } 53 54 public boolean next() throws DataSetException 55 { 56 return _iterator.next(); 57 } 58 59 public ITableMetaData getTableMetaData() throws DataSetException 60 { 61 return _iterator.getTableMetaData(); 62 } 63 64 public ITable getTable() throws DataSetException 65 { 66 return new DefaultTable(_iterator.getTableMetaData()); 67 } 68 } 69 } 70 | Popular Tags |