org.dbunit.dataset
Class ReplacementTable

java.lang.Object
  extended by org.dbunit.dataset.ReplacementTable
All Implemented Interfaces:
ITable

public class ReplacementTable
extends Object
implements ITable

Decorator that replaces configured values from the decorated table with replacement values.

Since:
Mar 17, 2003
Version:
$Revision: 855 $
Author:
Manuel Laflamme

Field Summary
 
Fields inherited from interface org.dbunit.dataset.ITable
NO_VALUE
 
Constructor Summary
ReplacementTable(ITable table)
          Create a new ReplacementTable object that decorates the specified table.
ReplacementTable(ITable table, Map objectMap, Map substringMap, String startDelimiter, String endDelimiter)
           
 
Method Summary
 void addReplacementObject(Object originalObject, Object replacementObject)
          Add a new Object replacement mapping.
 void addReplacementSubstring(String originalSubstring, String replacementSubstring)
          Add a new substring replacement mapping.
 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.
 void setStrictReplacement(boolean strictReplacement)
          Setting this property to true indicates that when no replacement is found for a delimited substring the replacement will fail fast.
 void setSubstringDelimiters(String startDelimiter, String endDelimiter)
          Sets substring delimiters.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReplacementTable

public ReplacementTable(ITable table)
Create a new ReplacementTable object that decorates the specified table.

Parameters:
table - the decorated table

ReplacementTable

public ReplacementTable(ITable table,
                        Map objectMap,
                        Map substringMap,
                        String startDelimiter,
                        String endDelimiter)
Method Detail

setStrictReplacement

public void setStrictReplacement(boolean strictReplacement)
Setting this property to true indicates that when no replacement is found for a delimited substring the replacement will fail fast.

Parameters:
strictReplacement - true if replacement should be strict

addReplacementObject

public void addReplacementObject(Object originalObject,
                                 Object replacementObject)
Add a new Object replacement mapping.

Parameters:
originalObject - the object to replace
replacementObject - the replacement object

addReplacementSubstring

public void addReplacementSubstring(String originalSubstring,
                                    String replacementSubstring)
Add a new substring replacement mapping.

Parameters:
originalSubstring - the substring to replace
replacementSubstring - the replacement substring

setSubstringDelimiters

public void setSubstringDelimiters(String startDelimiter,
                                   String endDelimiter)
Sets substring delimiters.


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

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2012. All Rights Reserved.