src/org/nutz/aop/interceptor/AbstractMethodInterceptor.java
public void filter(InterceptorChain chain) throws Throwable {
        try {
            if (beforeInvoke(chain.getCallingObj(), chain.getCallingMethod(), chain.getArgs()))
                chain.doChain();
            Object obj = afterInvoke(    chain.getCallingObj(),
                                        chain.getReturn(),
                                        chain.getCallingMethod(),
                                        chain.getArgs());
            chain.setReturnValue(obj);
        }
        catch (Exception e) {
            if (whenException(e, chain.getCallingObj(), chain.getCallingMethod(), chain.getArgs()))
                throw e;
        }
        catch (Throwable e) {
            if (whenError(e, chain.getCallingObj(), chain.getCallingMethod(), chain.getArgs()))
                throw e;
        }

    }
public void filter(InterceptorChain chain) throws Throwable {
        try {
            if (beforeInvoke(chain.getCallingObj(), chain.getCallingMethod(), chain.getArgs()))
                chain.doChain();
            Object obj = afterInvoke(    chain.getCallingObj(),
                                        chain.getReturn(),
                                        chain.getCallingMethod(),
                                        chain.getArgs());
            chain.setReturnValue(obj);
        }
        catch (Exception e) {
            if (whenException(e, chain.getCallingObj(), chain.getCallingMethod(), chain.getArgs()))
                throw e;
        }
        catch (Throwable e) {
            if (whenError(e, chain.getCallingObj(), chain.getCallingMethod(), chain.getArgs()))
                throw e;
        }

    }
public void filter ( InterceptorChain chain ) throws Throwable { try { if ( beforeInvoke ( chain . getCallingObj ( ) , chain . getCallingMethod ( ) , chain . getArgs ( ) ) ) chain . doChain ( ) ; Object obj = afterInvoke ( chain . getCallingObj ( ) , chain . getReturn ( ) , chain . getCallingMethod ( ) , chain . getArgs ( ) ) ; chain . setReturnValue ( obj ) ; } catch ( Exception e ) { if ( whenException ( e , chain . getCallingObj ( ) , chain . getCallingMethod ( ) , chain . getArgs ( ) ) ) throw e ; } catch ( Throwable e ) { if ( whenError ( e , chain . getCallingObj ( ) , chain . getCallingMethod ( ) , chain . getArgs ( ) ) ) throw e ; } }
拦截方法调用, 将拦截器的行为, 分成: 之前,之后,抛异常,抛错误 -- 4种拦截点
拦截方法调用 将拦截器的行为 分成 : 之前 之后 抛异常 抛错误 -- 4种拦截点