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" });
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,
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,
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() . |
String |
getName()
Return the name of the table.
|
String |
getRequest()
Returns the SQL request.
|
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 |
setName(String name)
Sets the name of the table.
|
collectRowsFromResultSet, controlIfAllThePksNameExistInTheColumns, getColumn, getColumnsNameList, getDataType, getPksNameList, getRow, getRowFromPksValues, getRowsList, setColumnsNameList, setPksNameList
getCatalog, getConnection, getDataSource, getSchema, getSource, setDataSource, setSource
public 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 String getName()
setName(String)
public Table setName(String name)
name
- The name of the table.getName()
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 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 AssertJ. All Rights Reserved.