@Test public void testGetProxy() throws Exception { DataSource actual = mock(DataSource.class); RegexProxyFactory<DataSource> factory = new RegexProxyFactory<DataSource>(DataSource.class); DataSource proxy = factory.getProxy(actual); proxy.getConnection(); proxy.getConnection(); assertThat(proxy, not(sameInstance(actual))); verify(actual, times(2)).getConnection(); }
public T getProxy(T object) { ProxyInterceptorAware<T> proxy = getProxyInterceptor(object); return proxy.getProxy(); }
RegexProxyFactory implements ProxyAware<T> { public T getProxy(T object) { ProxyInterceptorAware<T> proxy = getProxyInterceptor(object); return proxy.getProxy(); } }
RegexProxyFactory implements ProxyAware<T> { public T getProxy(T object) { ProxyInterceptorAware<T> proxy = getProxyInterceptor(object); return proxy.getProxy(); } RegexProxyFactory(Class<T> clazz); }
RegexProxyFactory implements ProxyAware<T> { public T getProxy(T object) { ProxyInterceptorAware<T> proxy = getProxyInterceptor(object); return proxy.getProxy(); } RegexProxyFactory(Class<T> clazz); T getProxy(T object); @SuppressWarnings("unchecked") ProxyInterceptorAware<T> getProxyInterceptor(T object); void addMethodListener(String regex, RegexMethodInterceptorListener<T> listener); }
RegexProxyFactory implements ProxyAware<T> { public T getProxy(T object) { ProxyInterceptorAware<T> proxy = getProxyInterceptor(object); return proxy.getProxy(); } RegexProxyFactory(Class<T> clazz); T getProxy(T object); @SuppressWarnings("unchecked") ProxyInterceptorAware<T> getProxyInterceptor(T object); void addMethodListener(String regex, RegexMethodInterceptorListener<T> listener);  }