Code example for ProxyFactory

Methods: getProxy, addAdvice

0
	} 
 
	private void testThrowable(Throwable t) throws Throwable { 
 
		JavaSpaceInterceptor si = new JavaSpaceInterceptor(template); 
		ProxyFactory pf = new ProxyFactory(new Class[] { ITestBean.class }); 
		pf.addAdvice(new PerformanceMonitorInterceptor()); 
		pf.addAdvice(si); 
 
		ITestBean proxy = (ITestBean) pf.getProxy(); 
 
		try { 
			proxy.exceptional(t); 
			fail("Should have aborted with exception"); 
		} 
		catch (Throwable got) { 
			if (got.getClass().equals(t.getClass())) { 
				// Ok 
				System.out.println("Expected exception, " + got); 
			} 
Contextual code suggestions in your IDE  Get Codota for Java