throw createException(rose, local);
}
}
protected Object innerExecute(Rose rose) throws Throwable {
Invocation inv = rose.getInvocation();
// creates parameter binding result (not bean, just simple type, like int, Integer, int[] ...
ParameterBindingResult paramBindingResult = new ParameterBindingResult(inv);
String paramBindingResultName = MODEL_KEY_PREFIX + paramBindingResult.getObjectName();
inv.addModel(paramBindingResultName, paramBindingResult);
// resolves method parameters, adds the method parameters to model
Object[] methodParameters = methodParameterResolver.resolve(inv, paramBindingResult);
((InvocationBean) inv).setMethodParameters(methodParameters);
String[] parameterNames = methodParameterResolver.getParameterNames();
Object instruction = null;
ParamMetaData[] metaDatas = methodParameterResolver.getParamMetaDatas();
// validators
for (int i = 0; i < this.validators.length; i++) {
if (validators[i] != null && !(methodParameters[i] instanceof Errors)) {
Errors errors = inv.getBindingResult(parameterNames[i]);
instruction = validators[i].validate(//
metaDatas[i], inv, methodParameters[i], errors);
if (logger.isDebugEnabled()) {
logger.debug("do validate [" + validators[i].getClass().getName()
+ "] and return '" + instruction + "'");
}
// 如果返回的instruction不是null、boolean或空串==>杯具:流程到此为止!
if (instruction != null) {
if (instruction instanceof Boolean) {
continue;
}
if (instruction instanceof String && ((String) instruction).length() == 0) {
continue;
}
return instruction;
}
}
}
//
for (int i = 0; i < parameterNames.length; i++) {
if (parameterNames[i] != null && methodParameters[i] != null
&& inv.getModel().get(parameterNames[i]) != methodParameters[i]) {
inv.addModel(parameterNames[i], methodParameters[i]);
}
}
// intetceptors & controller
return new InvocationChainImpl(rose).doNext();