📄 interceptorchainimpl.java
字号:
package com.javaeedev.lightweight.mvc;
/**
* Used for holds an interceptor chain.
*
* @author Xuefeng
*/
class InterceptorChainImpl implements InterceptorChain {
private final Interceptor[] interceptors;
private int index = 0;
private ModelAndView mv = null;
InterceptorChainImpl(Interceptor[] interceptors) {
this.interceptors = interceptors;
}
ModelAndView getModelAndView() {
return mv;
}
public void doInterceptor(Action action) throws Exception {
if(index==interceptors.length)
mv = action.execute();
else {
// must update index first, otherwise will cause stack overflow:
index++;
interceptors[index-1].intercept(action, this);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -