@Test public void checkIt() throws IOException { assertThat(ds, instanceOf(Flushable.class)); assertThat(ds, instanceOf(DataSource.class)); final FlushableDataSourceHandler handler = FlushableDataSourceHandler.class.cast(Proxy.getInvocationHandler(ds)); final CommonDataSource delegate = handler.getDelegate(); assertNotNull(delegate); assertFalse(BasicDataSource.class.cast(delegate).isClosed()); Flushable.class.cast(ds).flush(); assertTrue(BasicDataSource.class.cast(delegate).isClosed()); final CommonDataSource newDelegate = handler.getDelegate(); assertFalse(BasicDataSource.class.cast(newDelegate).isClosed()); assertNotSame(newDelegate, delegate); }
@Override public CommonDataSource getDelegate() { return delegate.get(); }
FlushableDataSourceHandler implements DelegatableHandler { @Override public CommonDataSource getDelegate() { return delegate.get(); } }
FlushableDataSourceHandler implements DelegatableHandler { @Override public CommonDataSource getDelegate() { return delegate.get(); } FlushableDataSourceHandler(final CommonDataSource original, final FlushConfig config, final ResettableDataSourceHandler resettableHandler); }
FlushableDataSourceHandler implements DelegatableHandler { @Override public CommonDataSource getDelegate() { return delegate.get(); } FlushableDataSourceHandler(final CommonDataSource original, final FlushConfig config, final ResettableDataSourceHandler resettableHandler); @Override Object invoke(final Object proxy, final Method method, final Object[] args); @Override CommonDataSource getDelegate(); void updateDataSource(final CommonDataSource ds); }
FlushableDataSourceHandler implements DelegatableHandler { @Override public CommonDataSource getDelegate() { return delegate.get(); } FlushableDataSourceHandler(final CommonDataSource original, final FlushConfig config, final ResettableDataSourceHandler resettableHandler); @Override Object invoke(final Object proxy, final Method method, final Object[] args); @Override CommonDataSource getDelegate(); void updateDataSource(final CommonDataSource ds); static final String[] FACTORY_ARGS; }