public class OrderedTableNameMap extends Object
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.Constructor and Description |
---|
OrderedTableNameMap(boolean caseSensitiveTableNames)
Creates a new map which does strictly force that one table can only occur once.
|
Modifier and Type | Method and Description |
---|---|
void |
add(String tableName,
Object object)
Adds the given table name to the map of table names, associating
it with the given object.
|
boolean |
containsTable(String tableName)
Checks if this map contains the given table name
|
Object |
get(String tableName)
Returns the object associated with the given table name
|
String |
getLastTableName() |
String |
getTableName(String tableName)
Returns the table name in the correct case (for example as upper case string)
|
String[] |
getTableNames()
Provides the ordered table names having the same order in which the table
names have been added via
add(String, Object) . |
boolean |
isLastTable(String tableName) |
Collection |
orderedValues() |
void |
setLastTable(String tableName) |
String |
toString() |
void |
update(String tableName,
Object object)
Updates the value associated with the given table name.
|
public OrderedTableNameMap(boolean caseSensitiveTableNames)
caseSensitiveTableNames
- Whether or not table names should be case sensitivepublic Object get(String tableName)
tableName
- The table name for which the associated object is retrievedpublic String[] getTableNames()
add(String, Object)
.public boolean containsTable(String tableName)
tableName
- true
if the map of tables contains the given table namepublic boolean isLastTable(String tableName)
tableName
- The table name to checktrue
if the given tableName matches the last table that has been added to this map.public String getLastTableName()
null
if no
table has been added yet.public void setLastTable(String tableName) throws NoSuchTableException
NoSuchTableException
public void add(String tableName, Object object) throws AmbiguousTableNameException
tableName
- The table name to be addedobject
- Object to be associated with the given table name. Can be nullAmbiguousTableNameException
- If the given table name already existspublic Collection orderedValues()
public void update(String tableName, Object object)
tableName
- The table name for which the association should be updatedobject
- The new object to be associated with the given table namepublic String getTableName(String tableName)
tableName
- The input table name to be resolvedCopyright © 2002–2020. All rights reserved.