Class DelegatingDataSource
java.lang.Object
io.micronaut.data.connection.jdbc.advice.DelegatingDataSource
- All Implemented Interfaces:
- Wrapper,- CommonDataSource,- DataSource
JDBC 
DataSource implementation that delegates all calls
 to a given target DataSource.
 This class is meant to be subclassed, with subclasses overriding only
 those methods (such as getConnection()) that should not simply
 delegate to the target DataSource.
- Since:
- 1.1
- Author:
- Juergen Hoeller, graemerocher
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionDelegatingDataSource(@NonNull DataSource targetDataSource) Create a new DelegatingDataSource.
- 
Method SummaryModifier and TypeMethodDescriptiongetConnection(String username, String password) intfinal @NonNull DataSourcebooleanisWrapperFor(Class<?> iface) voidsetLoginTimeout(int seconds) voidsetLogWriter(PrintWriter out) <T> Tstatic @NonNull DataSourceunwrapDataSource(@NonNull DataSource dataSource) Unwraps the data source obtaining the target.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.sql.CommonDataSourcecreateShardingKeyBuilderMethods inherited from interface javax.sql.DataSourcecreateConnectionBuilder
- 
Constructor Details- 
DelegatingDataSourceCreate a new DelegatingDataSource.- Parameters:
- targetDataSource- the target DataSource
 
 
- 
- 
Method Details- 
getTargetDataSource- Returns:
- Return the target DataSource that this DataSource should delegate to.
 
- 
getConnection- Specified by:
- getConnectionin interface- DataSource
- Throws:
- SQLException
 
- 
getConnection- Specified by:
- getConnectionin interface- DataSource
- Throws:
- SQLException
 
- 
getLogWriter- Specified by:
- getLogWriterin interface- CommonDataSource
- Specified by:
- getLogWriterin interface- DataSource
- Throws:
- SQLException
 
- 
setLogWriter- Specified by:
- setLogWriterin interface- CommonDataSource
- Specified by:
- setLogWriterin interface- DataSource
- Throws:
- SQLException
 
- 
getLoginTimeout- Specified by:
- getLoginTimeoutin interface- CommonDataSource
- Specified by:
- getLoginTimeoutin interface- DataSource
- Throws:
- SQLException
 
- 
setLoginTimeout- Specified by:
- setLoginTimeoutin interface- CommonDataSource
- Specified by:
- setLoginTimeoutin interface- DataSource
- Throws:
- SQLException
 
- 
unwrap- Specified by:
- unwrapin interface- Wrapper
- Throws:
- SQLException
 
- 
isWrapperFor- Specified by:
- isWrapperForin interface- Wrapper
- Throws:
- SQLException
 
- 
getParentLogger- Specified by:
- getParentLoggerin interface- CommonDataSource
 
- 
unwrapDataSource@NonNull public static @NonNull DataSource unwrapDataSource(@NonNull @NonNull DataSource dataSource) Unwraps the data source obtaining the target.- Parameters:
- dataSource- The data source
- Returns:
- The target
 
 
-