@ThreadSafe public final class Tables extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Tables.ColumnNameFilter
A filter for columns.
|
static interface |
Tables.TableChanger |
static interface |
Tables.TableNameFilter
A filter for tables.
|
| Modifier and Type | Field and Description |
|---|---|
private Set<TableId> |
changes |
private FunctionalReadWriteLock |
lock |
private Map<TableId,TableImpl> |
tablesByTableId |
| Modifier | Constructor and Description |
|---|---|
|
Tables()
Create an empty set of definitions.
|
protected |
Tables(Tables other) |
| Modifier and Type | Method and Description |
|---|---|
Tables |
clone() |
Set<TableId> |
drainChanges() |
TableEditor |
editOrCreateTable(String catalogName,
String schemaName,
String tableName)
Obtain an editor for the identified table or, if there is no such table, create an editor with the specified ID.
|
TableEditor |
editOrCreateTable(TableId tableId)
Obtain an editor for the table with the given ID.
|
TableEditor |
editTable(String catalogName,
String schemaName,
String tableName)
Obtain an editor for the identified table.
|
TableEditor |
editTable(TableId tableId)
Obtain an editor for the table with the given ID.
|
boolean |
equals(Object obj) |
static Tables.TableNameFilter |
filterFor(Predicate<TableId> predicate)
Create a
Tables.TableNameFilter for the given Predicate. |
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)
Add or update the definition for the identified table.
|
Table |
removeTable(TableId tableId)
Remove the definition of the identified table.
|
Table |
renameTable(TableId existingTableId,
TableId newTableId)
Rename an existing table.
|
int |
size()
Get the number of tables that are in this object.
|
Tables |
subset(Predicate<TableId> filter) |
Set<TableId> |
tableIds()
Get the set of
TableIds 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.
|
Table |
updateTable(TableId tableId,
Tables.TableChanger changer)
Add or update the definition for the identified table.
|
private final FunctionalReadWriteLock lock
public Tables()
protected Tables(Tables other)
public static Tables.TableNameFilter filterFor(Predicate<TableId> predicate)
Tables.TableNameFilter for the given Predicate.predicate - the TableId predicate filter; may be nullpublic int size()
public Table overwriteTable(TableId tableId, List<Column> columnDefs, List<String> primaryKeyColumnNames)
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 emptypublic Table overwriteTable(Table table)
table - the definition for the table; may not be nullpublic 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 updateTable(TableId tableId, Tables.TableChanger changer)
tableId - the identifier of the tablechanger - the function that accepts and changes the mutable ordered list of column definitions and the mutable set of
column names that make up the primary key; may not be nullpublic 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()
TableIds 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 editTable(String catalogName, String schemaName, String tableName)
Table
needs to be added back to this object via overwriteTable(Table).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 TableEditor editOrCreateTable(TableId tableId)
Table
needs to be added back to this object via overwriteTable(Table).tableId - the identifier of the tablepublic TableEditor editOrCreateTable(String catalogName, String schemaName, String tableName)
Table needs to be added back to this object via
overwriteTable(Table).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 tableCopyright © 2016 JBoss by Red Hat. All rights reserved.