use of com.tvd12.ezyfox.asm.EzyFunction in project ezyfox-server by youngmonkeys.
the class EzyRequestHandlerImplementer method makeHandleRequestMethodContent.
protected String makeHandleRequestMethodContent() {
EzyMethod method = getHandleRequestMethod();
EzyFunction function = new EzyFunction(method).throwsException();
EzyBody body = function.body();
int paramCount = prepareHandleMethodArguments(body);
EzyInstruction instruction = new EzyInstruction("\t", "\n");
StringBuilder answerExpression = new StringBuilder();
if (handlerMethod.getReturnType() != void.class) {
answerExpression.append(Object.class.getName()).append(" data = ");
}
answerExpression.append("this.controller.").append(handlerMethod.getName()).append("(");
for (int i = 0; i < paramCount; ++i) {
answerExpression.append(PARAMETER_PREFIX).append(i);
if (i < paramCount - 1) {
answerExpression.append(", ");
}
}
answerExpression.append(")");
instruction.append(answerExpression);
body.append(instruction);
if (handlerMethod.getReturnType() != void.class) {
EzyInstruction responseInstruction = new EzyInstruction("\t", "\n").invoke("this", "responseToSession", "arg1", "data");
body.append(responseInstruction);
}
return function.toString();
}
Aggregations