org.dbunit.dataset
Class FilteredDataSet

java.lang.Object
  extended by org.dbunit.dataset.AbstractDataSet
      extended by org.dbunit.dataset.FilteredDataSet
All Implemented Interfaces:
IDataSet

public class FilteredDataSet
extends AbstractDataSet

Decorates a dataset and exposes only some tables from it. Can be used with different filtering strategies.

Since:
Feb 22, 2002
Version:
$Revision: 1049 $
Author:
Manuel Laflamme
See Also:
ITableFilter, SequenceTableFilter, DefaultTableFilter

Field Summary
 
Fields inherited from class org.dbunit.dataset.AbstractDataSet
_orderedTableNameMap
 
Constructor Summary
FilteredDataSet(ITableFilter filter, IDataSet dataSet)
          Creates a FilteredDataSet that decorates the specified dataset and exposes only the tables allowed by the specified filter.
FilteredDataSet(String[] tableNames, IDataSet dataSet)
          Creates a FilteredDataSet that decorates the specified dataset and exposes only the specified tables using SequenceTableFilter as filtering strategy.
 
Method Summary
protected  ITableIterator createIterator(boolean reversed)
          Creates an iterator which provides access to all tables of this dataset
 ITable getTable(String tableName)
          Returns the specified table.
 ITableMetaData getTableMetaData(String tableName)
          Returns the specified table metadata.
 String[] getTableNames()
          Returns names of tables in this dataset in proper sequence.
 
Methods inherited from class org.dbunit.dataset.AbstractDataSet
createTableNameMap, getTables, isCaseSensitiveTableNames, iterator, reverseIterator, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilteredDataSet

public FilteredDataSet(String[] tableNames,
                       IDataSet dataSet)
                throws AmbiguousTableNameException
Creates a FilteredDataSet that decorates the specified dataset and exposes only the specified tables using SequenceTableFilter as filtering strategy.

Throws:
AmbiguousTableNameException - If the given tableNames array contains ambiguous names

FilteredDataSet

public FilteredDataSet(ITableFilter filter,
                       IDataSet dataSet)
Creates a FilteredDataSet that decorates the specified dataset and exposes only the tables allowed by the specified filter.

Parameters:
dataSet - the filtered dataset
filter - the filtering strategy
Method Detail

createIterator

protected ITableIterator createIterator(boolean reversed)
                                 throws DataSetException
Description copied from class: AbstractDataSet
Creates an iterator which provides access to all tables of this dataset

Specified by:
createIterator in class AbstractDataSet
Parameters:
reversed - Whether the created iterator should be a reversed one or not
Returns:
The created ITableIterator
Throws:
DataSetException

getTableNames

public String[] getTableNames()
                       throws DataSetException
Description copied from interface: IDataSet
Returns names of tables in this dataset in proper sequence. Multiple occurrence of the same name may be returned if multiple tables having the same name are present in the dataset.

Specified by:
getTableNames in interface IDataSet
Overrides:
getTableNames in class AbstractDataSet
Throws:
DataSetException

getTableMetaData

public ITableMetaData getTableMetaData(String tableName)
                                throws DataSetException
Description copied from interface: IDataSet
Returns the specified table metadata.

Specified by:
getTableMetaData in interface IDataSet
Overrides:
getTableMetaData in class AbstractDataSet
Throws:
NoSuchTableException - if dataset do not contains the specified table
DataSetException

getTable

public ITable getTable(String tableName)
                throws DataSetException
Description copied from interface: IDataSet
Returns the specified table.

Specified by:
getTable in interface IDataSet
Overrides:
getTable in class AbstractDataSet
Throws:
NoSuchTableException - if dataset do not contains the specified table
DataSetException


Copyright © 2002-2012. All Rights Reserved.