public Object invoke(Object proxy, Method method, Object[] args)
            throws Throwable {

        String methodName = method.getName();
        if (methodName.equals("getTargetContext")) {
            return target;
        } else if (methodName.equals("equals")) {
            // Only consider equal when proxies are identical.
            return (proxy == args[0] ? Boolean.TRUE : Boolean.FALSE);
        } else if (methodName.equals("hashCode")) {
            // Use hashCode of Connection proxy.
            return hashCode();
        } else if (methodName.equals("close")) {
            doCloseConnection(target, contextSource);
            return null;
        } else if (LdapTransactionUtils
                .isSupportedWriteTransactionOperation(methodName)) {
            // Store transaction data and allow operation to proceed.
            CompensatingTransactionUtils.performOperation(contextSource,
                    target, method, args);
            return null;
        } else {
            try {
                return method.invoke(target, args);
            } catch (InvocationTargetException e) {
                throw e.getTargetException();
            }
        }
    }
public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { String methodName = method . getName ( ) ; if ( methodName . equals ( "getTargetContext" ) ) { return target ; } else if ( methodName . equals ( "equals" ) ) { return ( proxy == args [ 0 ] ? Boolean . TRUE : Boolean . FALSE ) ; } else if ( methodName . equals ( "hashCode" ) ) { return hashCode ( ) ; } else if ( methodName . equals ( "close" ) ) { doCloseConnection ( target , contextSource ) ; return null ; } else if ( LdapTransactionUtils . isSupportedWriteTransactionOperation ( methodName ) ) { CompensatingTransactionUtils . performOperation ( contextSource , target , method , args ) ; return null ; } else { try { return method . invoke ( target , args ) ; } catch ( InvocationTargetException e ) { throw e . getTargetException ( ) ; } } }
/*
@see java.lang.reflect.InvocationHandler#invoke(java.lang.Object,
java.lang.reflect.Method, java.lang.Object[])