类 DataSourceWrapper
java.lang.Object
cn.featherfly.common.db.wrapper.DataSourceWrapper
public class DataSourceWrapper
extends java.lang.Object
javax.sql.DataSource的包装类,包装所有检查异常(SQLEception)为非检查异常(JdbcException)
-
构造器概要
构造器 构造器 说明 DataSourceWrapper(javax.sql.DataSource dataSource)Instantiates a new data source wrapper. -
方法概要
修饰符和类型 方法 说明 ConnectionWrappergetConnection()Gets the connection.ConnectionWrappergetConnection(java.lang.String username, java.lang.String password)Gets the connection.javax.sql.DataSourcegetDataSource()Gets the data source.intgetLoginTimeout()Gets the login timeout.java.io.PrintWritergetLogWriter()Gets the log writer.booleanisWrapperFor(java.lang.Class<?> iface)Checks if is wrapper for.voidsetLoginTimeout(int seconds)Sets the login timeout.voidsetLogWriter(java.io.PrintWriter out)Sets the log writer.<T> Tunwrap(java.lang.Class<T> iface)Unwrap.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
构造器详细资料
-
DataSourceWrapper
public DataSourceWrapper(javax.sql.DataSource dataSource)Instantiates a new data source wrapper.- 参数:
dataSource- the data source
-
-
方法详细资料
-
getConnection
Gets the connection.- 返回:
- the connection
- 另请参阅:
DataSource
-
getConnection
Gets the connection.- 参数:
username- the usernamepassword- the password- 返回:
- the connection
- 另请参阅:
DataSource
-
getLogWriter
public java.io.PrintWriter getLogWriter()Gets the log writer.- 返回:
- the log writer
- 另请参阅:
DataSource
-
getLoginTimeout
public int getLoginTimeout()Gets the login timeout.- 返回:
- the login timeout
- 另请参阅:
DataSource
-
setLogWriter
public void setLogWriter(java.io.PrintWriter out)Sets the log writer.- 参数:
out- the new log writer- 另请参阅:
DataSource
-
setLoginTimeout
public void setLoginTimeout(int seconds)Sets the login timeout.- 参数:
seconds- the new login timeout- 另请参阅:
DataSource
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class<?> iface)Checks if is wrapper for.- 参数:
iface- the iface- 返回:
- true, if is wrapper for
- 另请参阅:
DataSource
-
unwrap
public <T> T unwrap(java.lang.Class<T> iface)Unwrap.- 类型参数:
T- the generic type- 参数:
iface- the iface- 返回:
- the t
- 另请参阅:
DataSource
-
getDataSource
public javax.sql.DataSource getDataSource()Gets the data source.- 返回:
- 返回dataSource(javax.sql.DataSource)
-