Package org.dbunit.dataset
Class OrderedTableNameMap
java.lang.Object
org.dbunit.dataset.OrderedTableNameMap
Associates a table name with an arbitrary object. Moreover the
order of the added table names is maintained and the ordered table
names can be retrieved via
getTableNames().
The map ensures that one table name can only be added once.
TODO In the future it might be discussed if a ListOrderedMap (apache-commons-collections) can/should be used.- Since:
- 2.4.0
- Version:
- $Revision$
- Author:
- gommma, Last changed by: $Author$
-
Constructor Summary
ConstructorsConstructorDescriptionOrderedTableNameMap(boolean caseSensitiveTableNames) Creates a new map which does strictly force that one table can only occur once. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given table name to the map of table names, associating it with the given object.booleancontainsTable(String tableName) Checks if this map contains the given table nameReturns the object associated with the given table namegetTableName(String tableName) Returns the table name in the correct case (for example as upper case string)String[]Provides the ordered table names having the same order in which the table names have been added viaadd(String, Object).booleanisLastTable(String tableName) voidsetLastTable(String tableName) toString()voidUpdates the value associated with the given table name.
-
Constructor Details
-
OrderedTableNameMap
public OrderedTableNameMap(boolean caseSensitiveTableNames) Creates a new map which does strictly force that one table can only occur once.- Parameters:
caseSensitiveTableNames- Whether or not table names should be case sensitive
-
-
Method Details
-
get
Returns the object associated with the given table name- Parameters:
tableName- The table name for which the associated object is retrieved- Returns:
- The object that has been associated with the given table name
-
getTableNames
Provides the ordered table names having the same order in which the table names have been added viaadd(String, Object).- Returns:
- The list of table names ordered in the sequence as they have been added to this map
-
containsTable
Checks if this map contains the given table name- Parameters:
tableName-- Returns:
- Returns
trueif the map of tables contains the given table name
-
isLastTable
- Parameters:
tableName- The table name to check- Returns:
trueif the given tableName matches the last table that has been added to this map.
-
getLastTableName
- Returns:
- The name of the last table that has been added to this map. Returns
nullif no table has been added yet.
-
setLastTable
- Throws:
NoSuchTableException
-
add
Adds the given table name to the map of table names, associating it with the given object.- Parameters:
tableName- The table name to be addedobject- Object to be associated with the given table name. Can be null- Throws:
AmbiguousTableNameException- If the given table name already exists
-
orderedValues
- Returns:
- The values of this map ordered in the sequence they have been added
-
update
Updates the value associated with the given table name. Must be invoked if the table name has already been added before.- Parameters:
tableName- The table name for which the association should be updatedobject- The new object to be associated with the given table name
-
getTableName
Returns the table name in the correct case (for example as upper case string)- Parameters:
tableName- The input table name to be resolved- Returns:
- The table name for the given string in the correct case.
-
toString
-