org.dbunit.dataset
Class DefaultTable

java.lang.Object
  extended byorg.dbunit.dataset.AbstractTable
      extended byorg.dbunit.dataset.DefaultTable
All Implemented Interfaces:
ITable
Direct Known Subclasses:
CachedTable

public class DefaultTable
extends AbstractTable

Since:
Feb 17, 2002
Version:
$Revision: 1.10 $
Author:
Manuel Laflamme

Field Summary
 
Fields inherited from interface org.dbunit.dataset.ITable
NO_VALUE
 
Constructor Summary
DefaultTable(ITableMetaData metaData)
           
DefaultTable(ITableMetaData metaData, java.util.List list)
          Deprecated. Use public mutators to initialize table values instead
DefaultTable(java.lang.String tableName)
          Creates a new empty table having the specified name.
DefaultTable(java.lang.String tableName, Column[] columns)
          Creates a new empty table with specified metadata.
DefaultTable(java.lang.String tableName, Column[] columns, java.util.List list)
          Deprecated. Use public mutators to initialize table values instead
 
Method Summary
 void addRow()
          Inserts a new empty row.
 void addRow(java.lang.Object[] values)
          Inserts a new row initialized with specified array of values.
 void addTableRows(ITable table)
          Inserts all rows from the specified table.
 int getRowCount()
          Returns this table row count.
 ITableMetaData getTableMetaData()
          Returns this table metadata.
 java.lang.Object getValue(int row, java.lang.String column)
          Returns this table value for the specified row and column.
 java.lang.Object setValue(int row, java.lang.String column, java.lang.Object value)
          Replaces the value at the specified position in this table with the specified value.
 
Methods inherited from class org.dbunit.dataset.AbstractTable
assertValidColumn, assertValidRowIndex, assertValidRowIndex, getColumnIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTable

public DefaultTable(ITableMetaData metaData,
                    java.util.List list)
Deprecated. Use public mutators to initialize table values instead

Creates a new empty table with specified metadata and values.


DefaultTable

public DefaultTable(java.lang.String tableName)
Creates a new empty table having the specified name.


DefaultTable

public DefaultTable(java.lang.String tableName,
                    Column[] columns,
                    java.util.List list)
Deprecated. Use public mutators to initialize table values instead

Creates a new empty table with specified metadata and values.


DefaultTable

public DefaultTable(java.lang.String tableName,
                    Column[] columns)
Creates a new empty table with specified metadata.


DefaultTable

public DefaultTable(ITableMetaData metaData)
Method Detail

addRow

public void addRow()
            throws DataSetException
Inserts a new empty row. You can add values with setValue(int, java.lang.String, java.lang.Object).

Throws:
DataSetException

addRow

public void addRow(java.lang.Object[] values)
            throws DataSetException
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 from ITableMetaData.getColumns().
Throws:
DataSetException
See Also:
getTableMetaData()

addTableRows

public void addTableRows(ITable table)
                  throws DataSetException
Inserts all rows from the specified table.

Parameters:
table - The source table.
Throws:
DataSetException

setValue

public java.lang.Object setValue(int row,
                                 java.lang.String column,
                                 java.lang.Object value)
                          throws RowOutOfBoundsException,
                                 NoSuchColumnException,
                                 DataSetException
Replaces the value at the specified position in this table with the specified value.

Parameters:
row - The row index
column - The column name
value - 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 range
NoSuchColumnException - if the column does not exist
DataSetException - if an unexpected error occurs

getTableMetaData

public ITableMetaData getTableMetaData()
Description copied from interface: ITable
Returns this table metadata.


getRowCount

public int getRowCount()
Description copied from interface: ITable
Returns this table row count.


getValue

public java.lang.Object getValue(int row,
                                 java.lang.String column)
                          throws DataSetException
Description copied from interface: ITable
Returns this table value for the specified row and column.

Throws:
DataSetException


Copyright © 2002-2004 DbUnit.org. All Rights Reserved.