public class Table extends AbstractDbData<Table>
The different informations of the table are Source or DataSource, name of the table and optionally
the columns to check and to exclude.
Examples of instantiation :
This Table point to a table called movie in a H2 database in memory like indicated in the
Source.
Source source = new Source("jdbc:h2:mem:test", "sa", "");
Table table = new Table(source, "movie");
Below the Table table1 point to a table called song (but only on the columns called
number and title).
And the Table table2 point to a table called musician (but ignore on the column called
birthday).
The Table use a DataSource instead of a Source like above.
DataSource dataSource = ...;
Table table1 = new Table(dataSource, "song", new String[] { "number", "title" }, null);
Table table2 = new Table(dataSource, "musician", null, new String[] { "birthday" });
| Modifier and Type | Class and Description |
|---|---|
static class |
Table.Order
Indicates an order with the name on which is the order and the type.
|
myself| Constructor and Description |
|---|
Table()
Default constructor.
|
Table(DataSource dataSource,
String name)
Constructor with a dataSource and the name of the table.
|
Table(DataSource dataSource,
String name,
Character startDelimiter,
Character endDelimiter)
Constructor with a dataSource and the name of the table.
|
Table(DataSource dataSource,
String name,
Character startDelimiter,
Character endDelimiter,
String[] columnsToCheck,
String[] columnsToExclude)
Constructor with a connection, the name of the table and the columns to check and to exclude.
|
Table(DataSource dataSource,
String name,
Character startDelimiter,
Character endDelimiter,
Table.Order[] columnsToOrder)
Constructor with a dataSource and the name of the table.
|
Table(DataSource dataSource,
String name,
Character startDelimiter,
Character endDelimiter,
Table.Order[] columnsToOrder,
String[] columnsToCheck,
String[] columnsToExclude)
Constructor with a connection, the name of the table and the columns to check and to exclude.
|
Table(DataSource dataSource,
String name,
String[] columnsToCheck,
String[] columnsToExclude)
Constructor with a connection, the name of the table and the columns to check and to exclude.
|
Table(DataSource dataSource,
String name,
Table.Order[] columnsToOrder)
Constructor with a dataSource and the name of the table.
|
Table(DataSource dataSource,
String name,
Table.Order[] columnsToOrder,
String[] columnsToCheck,
String[] columnsToExclude)
Constructor with a connection, the name of the table and the columns to check and to exclude.
|
Table(Source source,
String name)
Constructor with a
Source and the name of the table. |
Table(Source source,
String name,
Character startDelimiter,
Character endDelimiter)
Constructor with a
Source and the name of the table. |
Table(Source source,
String name,
Character startDelimiter,
Character endDelimiter,
String[] columnsToCheck,
String[] columnsToExclude)
Constructor with a
Source, the name of the table and the columns to check and to exclude. |
Table(Source source,
String name,
Character startDelimiter,
Character endDelimiter,
Table.Order[] columnsToOrder)
Constructor with a
Source and the name of the table. |
Table(Source source,
String name,
Character startDelimiter,
Character endDelimiter,
Table.Order[] columnsToOrder,
String[] columnsToCheck,
String[] columnsToExclude)
Constructor with a
Source, the name of the table and the columns to check and to exclude. |
Table(Source source,
String name,
String[] columnsToCheck,
String[] columnsToExclude)
Constructor with a
Source, the name of the table and the columns to check and to exclude. |
Table(Source source,
String name,
Table.Order[] columnsToOrder)
Constructor with a
Source and the name of the table. |
Table(Source source,
String name,
Table.Order[] columnsToOrder,
String[] columnsToCheck,
String[] columnsToExclude)
Constructor with a
Source, the name of the table and the columns to check and to exclude. |
| Modifier and Type | Method and Description |
|---|---|
String[] |
getColumnsToCheck()
Returns the columns to check (which are present in
AbstractDbData.getColumnsNameList()). |
String[] |
getColumnsToExclude()
Returns the columns to exclude (which are not present in
AbstractDbData.getColumnsNameList()). |
Table.Order[] |
getColumnsToOrder()
Returns the columns to order (which are used in
ORDER BY). |
Character |
getEndDelimiter()
Returns the end delimiter for column name and table name.
|
String |
getName()
Return the name of the table.
|
String |
getRequest()
Returns the SQL request.
|
Character |
getStartDelimiter()
Returns the start delimiter for column name and table name.
|
protected void |
loadImpl(Connection connection)
Specific implementation of the loading for a
Table. |
Table |
setColumnsToCheck(String[] columnsToCheck)
Sets the columns to check (which are present in
AbstractDbData.getColumnsNameList()). |
Table |
setColumnsToExclude(String[] columnsToExclude)
Sets the columns to exclude (which are not present in
AbstractDbData.getColumnsNameList()). |
Table |
setColumnsToOrder(Table.Order[] columnsToOrder)
Sets the columns to order (which are used in
ORDER BY). |
Table |
setDataSource(DataSource dataSource)
Sets the data source.
|
Table |
setEndDelimiter(Character endDelimiter)
Sets the end delimiter for column name and table name.
|
Table |
setName(String name)
Sets the name of the table.
|
Table |
setSource(Source source)
Sets the source.
|
Table |
setStartDelimiter(Character startDelimiter)
Sets the start delimiter for column name and table name.
|
collectRowsFromResultSet, controlIfAllThePksNameExistInTheColumns, getColumn, getColumnsList, getColumnsNameList, getDataType, getPksNameList, getRow, getRowFromPksValues, getRowsList, setColumnsNameList, setPksNameList, sortRowsgetCatalog, getColumnLetterCase, getConnection, getDataSource, getPrimaryKeyLetterCase, getSchema, getSource, getTableLetterCasepublic Table()
public Table(Source source, String name)
Source and the name of the table.source - Source to connect to the database.name - Name of the table.public Table(Source source, String name, String[] columnsToCheck, String[] columnsToExclude)
Source, the name of the table and the columns to check and to exclude.source - Source to connect to the database.name - Name of the table.columnsToCheck - Array of the name of the columns to check. If null that means to check all the
columns.columnsToExclude - Array of the name of the columns to exclude. If null that means to exclude no
column.public Table(DataSource dataSource, String name)
dataSource - DataSource of the database.name - Name of the table.public Table(DataSource dataSource, String name, String[] columnsToCheck, String[] columnsToExclude)
dataSource - DataSource of the database.name - Name of the table.columnsToCheck - Array of the name of the columns to check. If null that means to check all the
columns.columnsToExclude - Array of the name of the columns to exclude. If null that means to exclude no
column.public Table(Source source, String name, Table.Order[] columnsToOrder)
Source and the name of the table.source - Source to connect to the database.name - Name of the table.public Table(Source source, String name, Table.Order[] columnsToOrder, String[] columnsToCheck, String[] columnsToExclude)
Source, the name of the table and the columns to check and to exclude.source - Source to connect to the database.name - Name of the table.columnsToCheck - Array of the name of the columns to check. If null that means to check all the
columns.columnsToExclude - Array of the name of the columns to exclude. If null that means to exclude no
column.public Table(DataSource dataSource, String name, Table.Order[] columnsToOrder)
dataSource - DataSource of the database.name - Name of the table.public Table(DataSource dataSource, String name, Table.Order[] columnsToOrder, String[] columnsToCheck, String[] columnsToExclude)
dataSource - DataSource of the database.name - Name of the table.columnsToCheck - Array of the name of the columns to check. If null that means to check all the
columns.columnsToExclude - Array of the name of the columns to exclude. If null that means to exclude no
column.public Table(Source source, String name, Character startDelimiter, Character endDelimiter)
Source and the name of the table.source - Source to connect to the database.name - Name of the table.startDelimiter - Start delimiter for column name and table name.endDelimiter - End delimiter for column name and table name.public Table(Source source, String name, Character startDelimiter, Character endDelimiter, String[] columnsToCheck, String[] columnsToExclude)
Source, the name of the table and the columns to check and to exclude.source - Source to connect to the database.name - Name of the table.startDelimiter - Start delimiter for column name and table name.endDelimiter - End delimiter for column name and table name.columnsToCheck - Array of the name of the columns to check. If null that means to check all the
columns.columnsToExclude - Array of the name of the columns to exclude. If null that means to exclude no
column.public Table(DataSource dataSource, String name, Character startDelimiter, Character endDelimiter)
dataSource - DataSource of the database.name - Name of the table.startDelimiter - Start delimiter for column name and table name.endDelimiter - End delimiter for column name and table name.public Table(DataSource dataSource, String name, Character startDelimiter, Character endDelimiter, String[] columnsToCheck, String[] columnsToExclude)
dataSource - DataSource of the database.name - Name of the table.startDelimiter - Start delimiter for column name and table name.endDelimiter - End delimiter for column name and table name.columnsToCheck - Array of the name of the columns to check. If null that means to check all the
columns.columnsToExclude - Array of the name of the columns to exclude. If null that means to exclude no
column.public Table(Source source, String name, Character startDelimiter, Character endDelimiter, Table.Order[] columnsToOrder)
Source and the name of the table.source - Source to connect to the database.name - Name of the table.startDelimiter - Start delimiter for column name and table name.endDelimiter - End delimiter for column name and table name.public Table(Source source, String name, Character startDelimiter, Character endDelimiter, Table.Order[] columnsToOrder, String[] columnsToCheck, String[] columnsToExclude)
Source, the name of the table and the columns to check and to exclude.source - Source to connect to the database.name - Name of the table.startDelimiter - Start delimiter for column name and table name.endDelimiter - End delimiter for column name and table name.columnsToCheck - Array of the name of the columns to check. If null that means to check all the
columns.columnsToExclude - Array of the name of the columns to exclude. If null that means to exclude no
column.public Table(DataSource dataSource, String name, Character startDelimiter, Character endDelimiter, Table.Order[] columnsToOrder)
dataSource - DataSource of the database.name - Name of the table.startDelimiter - Start delimiter for column name and table name.endDelimiter - End delimiter for column name and table name.public Table(DataSource dataSource, String name, Character startDelimiter, Character endDelimiter, Table.Order[] columnsToOrder, String[] columnsToCheck, String[] columnsToExclude)
dataSource - DataSource of the database.name - Name of the table.startDelimiter - Start delimiter for column name and table name.endDelimiter - End delimiter for column name and table name.columnsToCheck - Array of the name of the columns to check. If null that means to check all the
columns.columnsToExclude - Array of the name of the columns to exclude. If null that means to exclude no
column.public String getName()
setName(String)public Table setName(String name)
name - The name of the table.getName()public Table setDataSource(DataSource dataSource)
setDataSource in class AbstractDbElement<Table>dataSource - The DataSource (must be not null).AbstractDbElement.getDataSource()public Table setSource(Source source)
setSource in class AbstractDbElement<Table>source - Source to connect to the database (must be not null).AbstractDbElement.getSource()public String[] getColumnsToCheck()
AbstractDbData.getColumnsNameList()).null that means to check all the columns.setColumnsToCheck(String[])public Table setColumnsToCheck(String[] columnsToCheck)
AbstractDbData.getColumnsNameList()).columnsToCheck - Array of the name of the columns to check. If null that means to check all the
columns.NullPointerException - If one of the name in columnsToCheck is null.getColumnsToCheck()public String[] getColumnsToExclude()
AbstractDbData.getColumnsNameList()).setColumnsToExclude(String[])public Table setColumnsToExclude(String[] columnsToExclude)
AbstractDbData.getColumnsNameList()).columnsToExclude - The columns.getColumnsToExclude()public Table.Order[] getColumnsToOrder()
ORDER BY).null that means not to do order.setColumnsToOrder(Order[])public Table setColumnsToOrder(Table.Order[] columnsToOrder)
ORDER BY).columnsToOrder - The columns.getColumnsToOrder()public Character getStartDelimiter()
setStartDelimiter(Character)public Table setStartDelimiter(Character startDelimiter)
startDelimiter - The start delimiter for column name and table name.getStartDelimiter()public Character getEndDelimiter()
setEndDelimiter(Character)public Table setEndDelimiter(Character endDelimiter)
endDelimiter - The end delimiter for column name and table name.getEndDelimiter()public String getRequest()
getRequest in class AbstractDbData<Table>NullPointerException - If the name field is null.AbstractDbData.getRequest()protected void loadImpl(Connection connection) throws SQLException
Table.loadImpl in class AbstractDbData<Table>connection - Connection to the database provided by AbstractDbData.load() private method.NullPointerException - If the name field is null.SQLException - SQL Exception.AbstractDbData.loadImpl(Connection)Copyright © 2015–2017 AssertJ. All rights reserved.