@ThreadSafe public final class Tables extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Tables.ColumnNameFilter
A filter for columns.
|
static class |
Tables.ColumnNameFilterFactory |
static interface |
Tables.TableFilter
A filter for tables.
|
private static class |
Tables.TableIds
A set of table ids.
|
private static class |
Tables.TablesById
A map of tables by id.
|
Modifier and Type | Field and Description |
---|---|
private Tables.TableIds |
changes |
private FunctionalReadWriteLock |
lock |
private boolean |
tableIdCaseInsensitive |
private Tables.TablesById |
tablesByTableId |
Modifier | Constructor and Description |
---|---|
|
Tables()
Create case sensitive empty set of definitions.
|
|
Tables(boolean tableIdCaseInsensitive)
Create an empty set of definitions.
|
protected |
Tables(Tables other,
boolean tableIdCaseInsensitive) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
Tables |
clone() |
Set<TableId> |
drainChanges() |
TableEditor |
editOrCreateTable(TableId tableId)
Obtain an editor for the table with the given ID.
|
TableEditor |
editTable(TableId tableId)
Obtain an editor for the table with the given ID.
|
boolean |
equals(Object obj) |
Table |
forTable(String catalogName,
String schemaName,
String tableName)
Obtain the definition of the identified table.
|
Table |
forTable(TableId tableId)
Obtain the definition of the identified table.
|
int |
hashCode() |
Table |
overwriteTable(Table table)
Add or update the definition for the identified table.
|
Table |
overwriteTable(TableId tableId,
List<Column> columnDefs,
List<String> primaryKeyColumnNames,
String defaultCharsetName)
Add or update the definition for the identified table.
|
Table |
removeTable(TableId tableId)
Remove the definition of the identified table.
|
void |
removeTablesForDatabase(String schemaName) |
void |
removeTablesForDatabase(String catalogName,
String schemaName) |
Table |
renameTable(TableId existingTableId,
TableId newTableId)
Rename an existing table.
|
int |
size()
Get the number of tables that are in this object.
|
Tables |
subset(Tables.TableFilter filter) |
Set<TableId> |
tableIds()
Get the set of
TableId s for which there is a Schema . |
String |
toString() |
Table |
updateTable(TableId tableId,
Function<Table,Table> changer)
Add or update the definition for the identified table.
|
private final FunctionalReadWriteLock lock
private final Tables.TablesById tablesByTableId
private final Tables.TableIds changes
private final boolean tableIdCaseInsensitive
public Tables(boolean tableIdCaseInsensitive)
tableIdCaseInsensitive
- - true if lookup is case insensitive (typical for MySQL on Windows)public Tables()
protected Tables(Tables other, boolean tableIdCaseInsensitive)
public void clear()
public int size()
public Table overwriteTable(TableId tableId, List<Column> columnDefs, List<String> primaryKeyColumnNames, String defaultCharsetName)
tableId
- the identifier of the tablecolumnDefs
- the list of column definitions; may not be null or emptyprimaryKeyColumnNames
- the list of the column names that make up the primary key; may be null or emptydefaultCharsetName
- the name of the character set that should be used by defaultpublic Table overwriteTable(Table table)
table
- the definition for the table; may not be nullpublic void removeTablesForDatabase(String schemaName)
public Table renameTable(TableId existingTableId, TableId newTableId)
existingTableId
- the identifier of the existing table to be renamed; may not be nullnewTableId
- the new identifier for the table; may not be nullpublic Table updateTable(TableId tableId, Function<Table,Table> changer)
public Table removeTable(TableId tableId)
tableId
- the identifier of the tablepublic Table forTable(TableId tableId)
tableId
- the identifier of the tablepublic Table forTable(String catalogName, String schemaName, String tableName)
catalogName
- the name of the database catalog that contains the table; may be null if the JDBC driver does not
show a schema for this tableschemaName
- the name of the database schema that contains the table; may be null if the JDBC driver does not
show a schema for this tabletableName
- the name of the tablepublic Set<TableId> tableIds()
TableId
s for which there is a Schema
.public TableEditor editTable(TableId tableId)
Table
needs to be added back to this object via overwriteTable(Table)
.tableId
- the identifier of the tablepublic TableEditor editOrCreateTable(TableId tableId)
Table
needs to be added back to this object via overwriteTable(Table)
.tableId
- the identifier of the tablepublic Tables subset(Tables.TableFilter filter)
Copyright © 2021 JBoss by Red Hat. All rights reserved.