* @param obj 方法所在的对象。
*
* @return Interceptor代理对象。
*/
private InterceptorProxy createInterceptorProxy(Method method, Object obj) {
Interceptor interceptor = method.getAnnotation(Interceptor.class);
Class[] params = method.getParameterTypes();
//check interceptor invoke args
boolean requireAction = false;
//interceptor代理的方法无参数或参数仅为ActionInvocation或其子类
if (params.length == 0) {
requireAction = false;
} //未指定actionInvocationClass参数类型时允许ActionInvocation任意子类;否则为actionInvocationClass的父类
else if (isProxyMethod(params)) {
requireAction = true;
} else {
throw new IllegalArgumentException("Illegal arguments in Interceptor : " + method);
}
return new InterceptorProxy(interceptor.name().trim(), method, obj, requireAction);
}