@Test public void shouldDelegateUnwrapImplementing() throws Exception { dataSource = new DelegatingDataSourceWithWrapper(); assertThat(dataSource.unwrap(ExampleWrapper.class), is((ExampleWrapper) dataSource)); }
@SuppressWarnings("unchecked") public <T> T unwrap(Class<T> iface) throws SQLException { if (iface.isInstance(this)) { return (T) this; } return getTargetDataSource().unwrap(iface); }
DelegatingDataSource implements DataSource, InitializingBean { @SuppressWarnings("unchecked") public <T> T unwrap(Class<T> iface) throws SQLException { if (iface.isInstance(this)) { return (T) this; } return getTargetDataSource().unwrap(iface); } }
DelegatingDataSource implements DataSource, InitializingBean { @SuppressWarnings("unchecked") public <T> T unwrap(Class<T> iface) throws SQLException { if (iface.isInstance(this)) { return (T) this; } return getTargetDataSource().unwrap(iface); } DelegatingDataSource();  DelegatingDataSource(DataSource targetDataSource); }
DelegatingDataSource implements DataSource, InitializingBean { @SuppressWarnings("unchecked") public <T> T unwrap(Class<T> iface) throws SQLException { if (iface.isInstance(this)) { return (T) this; } return getTargetDataSource().unwrap(iface); } DelegatingDataSource();  DelegatingDataSource(DataSource targetDataSource); void setTargetDataSource(DataSource targetDataSource); DataSource getTargetDataSource(); void afterPropertiesSet(); Connection getConnection(); Connection getConnection(String username, String password); PrintWriter getLogWriter(); void setLogWriter(PrintWriter out); int getLoginTimeout(); void setLoginTimeout(int seconds); @SuppressWarnings("unchecked") T unwrap(Class<T> iface); boolean isWrapperFor(Class<?> iface); Logger getParentLogger(); }
DelegatingDataSource implements DataSource, InitializingBean { @SuppressWarnings("unchecked") public <T> T unwrap(Class<T> iface) throws SQLException { if (iface.isInstance(this)) { return (T) this; } return getTargetDataSource().unwrap(iface); } DelegatingDataSource();  DelegatingDataSource(DataSource targetDataSource); void setTargetDataSource(DataSource targetDataSource); DataSource getTargetDataSource(); void afterPropertiesSet(); Connection getConnection(); Connection getConnection(String username, String password); PrintWriter getLogWriter(); void setLogWriter(PrintWriter out); int getLoginTimeout(); void setLoginTimeout(int seconds); @SuppressWarnings("unchecked") T unwrap(Class<T> iface); boolean isWrapperFor(Class<?> iface); Logger getParentLogger();  }