Code example for ProxyFactory

Methods: getProxy, addAdvice, setInterfaces, setProxyTargetClass, setTarget

0
 
    private DataSource dataSource; 
 
    public Handle decorate(IDBI idbi, Handle handle) { 
 
        ProxyFactory pf = new ProxyFactory(); 
        pf.setProxyTargetClass(false); 
        pf.setInterfaces(new Class[] {Handle.class}); 
        pf.setTarget(handle); 
        pf.addAdvice(new SQLExceptionTranslatingThrowsAdvice(dataSource)); 
 
        Handle proxy = (Handle)pf.getProxy(); 
 
        return proxy; 
    } 
 
    public DataSource getDataSource() { 
        return dataSource; 
    } 
 
Contextual code suggestions in your IDE  Get Codota for Java