Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Prev Previous commit
Next Next commit
Fix a bug with primitives and stop execution as soon as an action match
  • Loading branch information
DayS committed May 24, 2013
commit 883af2e41c3e6633ee10171bee76cc109f7a31c9
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,8 @@ public String getTarget() {
@Override
public void process(Element element, JCodeModel codeModel, EBeanHolder holder) {
ExecutableElement executableElement = (ExecutableElement) element;

String methodName = element.getSimpleName().toString();

TypeMirror elementType = element.asType();

Classes classes = holder.classes();

// Action field
Expand Down Expand Up @@ -128,11 +125,11 @@ public void process(Element element, JCodeModel codeModel, EBeanHolder holder) {
String paramName = param.getSimpleName().toString();
String extraParamName = paramName + "Extra";
JClass extraParamClass = helper.typeMirrorToJClass(param.asType(), holder);
boolean isPrimitive = false; // param.getKind().isPrimitive();
boolean isPrimitive = param.asType().getKind().isPrimitive();

JExpression extraInvok;
if (isPrimitive) {
JPrimitiveType primitiveType = JType.parse(codeModel, elementType.toString());
JPrimitiveType primitiveType = JType.parse(codeModel, param.asType().toString());
JClass wrapperType = primitiveType.boxify();
extraInvok = JExpr.cast(wrapperType, extras.invoke("get").arg(paramName));
} else {
Expand All @@ -149,6 +146,8 @@ public void process(Element element, JCodeModel codeModel, EBeanHolder holder) {
} else {
callActionBlock.add(callActionInvok);
}

callActionBlock._return();
}

/*
Expand Down