D
- Class of the subclass (an implementation of AbstractDbElement
) : useful for the fluent methods
(setters).public abstract class AbstractDbElement<D extends AbstractDbElement<D>> extends Object
AbstractDbData
or a Change
).
So this class contains : the way to access the database with getSource()
and getDataSource()
(one
of them need to be set before loading the data).Modifier and Type | Field and Description |
---|---|
protected D |
myself
Class of the element.
|
Modifier and Type | Method and Description |
---|---|
protected static String |
getCatalog(Connection connection)
Returns the catalog from a connection.
|
protected Connection |
getConnection()
|
DataSource |
getDataSource()
Return the data source.
|
protected static String |
getSchema(Connection connection)
Returns the schema from a connection.
|
Source |
getSource()
Return the source.
|
D |
setDataSource(DataSource dataSource)
Sets the data source.
|
D |
setSource(Source source)
Sets the source.
|
protected final D extends AbstractDbElement<D> myself
public Source getSource()
Source
to connect.setSource(Source)
public D setSource(Source source)
source
- Source
to connect to the database (must be not null
).NullPointerException
- If source
is null
.getSource()
public DataSource getDataSource()
setDataSource(DataSource)
public D setDataSource(DataSource dataSource)
dataSource
- The DataSource
(must be not null
).NullPointerException
- If dataSource
is null
.getDataSource()
protected Connection getConnection() throws SQLException
Connection
differently, depending if it is a DataSource
or a Source
.SQLException
- SQL Exceptionprotected static String getCatalog(Connection connection) throws SQLException
connection
- The connection with the catalogSQLException
- SQL Exceptionprotected static String getSchema(Connection connection) throws SQLException
connection
- The connection with the catalogSQLException
- SQL ExceptionCopyright © 2015 AssertJ. All Rights Reserved.