public class AbstractMethodInterceptor extends Object implements MethodInterceptor
| 构造器和说明 |
|---|
AbstractMethodInterceptor() |
| 限定符和类型 | 方法和说明 |
|---|---|
Object |
afterInvoke(Object obj,
Object returnObj,
Method method,
Object... args)
在方法执行后拦截
|
boolean |
beforeInvoke(Object obj,
Method method,
Object... args)
在方法执行前拦截
|
void |
filter(InterceptorChain chain)
拦截方法调用, 将拦截器的行为, 分成: 之前,之后,抛异常,抛错误 -- 4种拦截点
|
boolean |
whenError(Throwable e,
Object obj,
Method method,
Object... args)
抛出Throwable的时候拦截
|
boolean |
whenException(Exception e,
Object obj,
Method method,
Object... args)
抛出Exception的时候拦截
|
public void filter(InterceptorChain chain) throws Throwable
filter 在接口中 MethodInterceptorThrowablepublic boolean beforeInvoke(Object obj, Method method, Object... args)
obj - 被拦截的对象method - 被拦截的方法args - 被拦截的方法的参数public Object afterInvoke(Object obj, Object returnObj, Method method, Object... args)
obj - 被拦截的对象returnObj - 被拦截的方法的返回值的对象method - 被拦截的方法args - 被拦截方法的参数public boolean whenException(Exception e, Object obj, Method method, Object... args)
e - 异常对象obj - 被拦截的对象method - 被拦截的方法args - 被拦截方法的返回值Copyright © 2017. All rights reserved.