Package org.dbunit.dataset
Class DefaultTable
java.lang.Object
org.dbunit.dataset.AbstractTable
org.dbunit.dataset.DefaultTable
- All Implemented Interfaces:
ITable
- Direct Known Subclasses:
CachedTable
Default table implementation backed by a simple java in-memory list.
- Since:
- Feb 17, 2002
- Version:
- $Revision$
- Author:
- Manuel Laflamme
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultTable(String tableName) Creates a new empty table having the specified name.DefaultTable(String tableName, Column[] columns) Creates a new empty table with specified metadata.DefaultTable(String tableName, Column[] columns, List list) Deprecated.Use public mutators to initialize table values insteadDefaultTable(ITableMetaData metaData) DefaultTable(ITableMetaData metaData, List list) Deprecated.Use public mutators to initialize table values instead -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRow()Inserts a new empty row.voidInserts a new row initialized with specified array of values.voidaddTableRows(ITable table) Inserts all rows from the specified table.intReturns this table row count.Returns this table metadata.Returns this table value for the specified row and column.Replaces the value at the specified position in this table with the specified value.toString()Methods inherited from class org.dbunit.dataset.AbstractTable
assertValidColumn, assertValidRowIndex, assertValidRowIndex, getColumnIndex
-
Constructor Details
-
DefaultTable
Deprecated.Use public mutators to initialize table values insteadCreates a new empty table with specified metadata and values. -
DefaultTable
Creates a new empty table having the specified name. -
DefaultTable
Deprecated.Use public mutators to initialize table values insteadCreates a new empty table with specified metadata and values. -
DefaultTable
Creates a new empty table with specified metadata. -
DefaultTable
-
-
Method Details
-
addRow
Inserts a new empty row. You can add values withsetValue(int, java.lang.String, java.lang.Object).- Throws:
DataSetException
-
addRow
Inserts a new row initialized with specified array of values.- Parameters:
values- The array of values. Each value correspond to the column at the same index fromITableMetaData.getColumns().- Throws:
DataSetException- See Also:
-
addTableRows
Inserts all rows from the specified table.- Parameters:
table- The source table.- Throws:
DataSetException
-
setValue
public Object setValue(int row, String column, Object value) throws RowOutOfBoundsException, NoSuchColumnException, DataSetException Replaces the value at the specified position in this table with the specified value.- Parameters:
row- The row indexcolumn- The column namevalue- The value to store at the specified location- Returns:
- the value previously at the specified location
- Throws:
RowOutOfBoundsException- if the row index is out of rangeNoSuchColumnException- if the column does not existDataSetException- if an unexpected error occurs
-
getTableMetaData
Description copied from interface:ITableReturns this table metadata. -
getRowCount
public int getRowCount()Description copied from interface:ITableReturns this table row count. -
getValue
Description copied from interface:ITableReturns this table value for the specified row and column.- Parameters:
row- The row index, starting with 0column- The name of the column- Returns:
- The value
- Throws:
DataSetException
-
toString
-