?? genericinvocationhandler.java
字號(hào):
package com.easyjf.aop;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* 測(cè)試
* @author stef_wu
*
*/
public class GenericInvocationHandler implements InvocationHandler {
private Object target = null;
private Object realtarget = null;
IMethodInterceptor methodInterceptor = null;
public void setTarget(Object target_) {
this.target = target_;
}
public void setRealTarget(Object realtarget_) {
this.realtarget = realtarget_;
}
public void setMethodInterceptor(IMethodInterceptor methodInterceptor_) {
this.methodInterceptor = methodInterceptor_;
}
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
// TODO Auto-generated method stub
try {
Object interceptBeforeReturnObject = null;
if (methodInterceptor != null) {
interceptBeforeReturnObject = methodInterceptor
.interceptBefore(proxy, method, args, realtarget);
}
Object retObject = method.invoke(target, args);
if (methodInterceptor != null) {
methodInterceptor.interceptAfter(proxy, method, args,
realtarget, retObject, interceptBeforeReturnObject);
}
return retObject;
} catch (InvocationTargetException e) {
throw e.getTargetException();
} catch (Exception e) {
throw e;
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -