org.dbunit.dataset
Class RowFilterTable

java.lang.Object
  extended by org.dbunit.dataset.RowFilterTable
All Implemented Interfaces:
IRowValueProvider, ITable

public class RowFilterTable
extends Object
implements ITable, IRowValueProvider

Filters table rows by using arbitrary column values of the table to check if a row should be filtered or not.
Implemented as a decorator for ITable. See dbunit feature request at #1959771

Since:
2.3.0
Version:
$Revision: 850 $ $Date: 2008-10-31 19:39:59 +0100 (Fri, 31 Oct 2008) $
Author:
gommma, Last changed by: $Author: gommma $

Field Summary
 
Fields inherited from interface org.dbunit.dataset.ITable
NO_VALUE
 
Constructor Summary
RowFilterTable(ITable table, IRowFilter rowFilter)
          Creates a new ITable where some rows can be filtered out from the original table
 
Method Summary
 Object getColumnValue(String columnName)
          Returns the column value for the column with the given name of the currently processed row
 int getRowCount()
          Returns this table row count.
 ITableMetaData getTableMetaData()
          Returns this table metadata.
 Object getValue(int row, String column)
          Returns this table value for the specified row and column.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RowFilterTable

public RowFilterTable(ITable table,
                      IRowFilter rowFilter)
               throws DataSetException
Creates a new ITable where some rows can be filtered out from the original table

Parameters:
table - The table to be wrapped
rowFilter - The row filter that checks for every row whether or not it should be filtered
Throws:
DataSetException
Method Detail

getTableMetaData

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

Specified by:
getTableMetaData in interface ITable

getRowCount

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

Specified by:
getRowCount in interface ITable

getValue

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

Specified by:
getValue in interface ITable
Parameters:
row - The row index, starting with 0
column - The name of the column
Returns:
The value
Throws:
NoSuchColumnException - if specified column name do not exist in this table
RowOutOfBoundsException - if specified row is less than zero or equals or greater than getRowCount
DataSetException

getColumnValue

public Object getColumnValue(String columnName)
                      throws DataSetException
Returns the column value for the column with the given name of the currently processed row

Specified by:
getColumnValue in interface IRowValueProvider
Parameters:
columnName - The db column name for which the value should be provided (current row's value)
Returns:
The value of the given column in the current row
Throws:
DataSetException
See Also:
IRowValueProvider.getColumnValue(java.lang.String)


Copyright © 2002-2012. All Rights Reserved.