1
示例
public ReturnType function() {
try {
Object[] args = new Object[]{};
Ret beforeRet = callOnBefore(args...);
// 返回对象
if (beforeRet.state == 1) {
return (ReturnType) beforeRet.respond;
}
// 抛出异常
if (beforeRet.state == 2) {
throw (Throwable) beforeRet.respond;
}
// 执行正常的业务逻辑
ReturnType retValue = ...;
Ret returnRet = callOnReturn(retValue);
// 返回对象
if (returnRet.state == 1) {
return (ReturnType) returnRet.respond;
}
// 抛出异常
if (returnRet.state == 2) {
throw (Throwable) returnRet.respond;
}
return retValue;
} catch (Throwable t) {
Ret throwRet = callOnThrow(t);
// 返回对象
if (throwRet.state == 1) {
return (ReturnType) throwRet.respond;
}
// 抛出异常
if (throwRet.state == 2) {
throw (Throwable) throwRet.respond;
}
throw t;
}
}
2
public Integer function() {
callOnBefore(args...);
// 业务逻辑
returnVal
callOnReturn(returnVal);
return returnVal;
}
标签:respond,return,字节,修改,state,returnRet,beforeRet,ReturnType,函数
From: https://www.cnblogs.com/cyyyyx/p/17651655.html