use of com.helger.jcodemodel.JVar in project androidannotations by androidannotations.
the class KeyEventCallbackMethodsDelegate method createOnKeyMultipleMethod.
private void createOnKeyMultipleMethod() {
JMethod method = getGeneratedClass().method(PUBLIC, codeModel().BOOLEAN, "onKeyMultiple");
method.annotate(Override.class);
JVar keyCode = method.param(codeModel().INT, "keyCode");
onKeyMultipleCountParam = method.param(codeModel().INT, "count");
onKeyMultipleKeyEventParam = method.param(getClasses().KEY_EVENT, "keyEvent");
JBlock methodBody = method.body();
onKeyMultipleSwitchBody = methodBody._switch(keyCode);
methodBody._return(_super().invoke(method).arg(keyCode).arg(onKeyMultipleCountParam).arg(onKeyDownKeyEventParam));
}
use of com.helger.jcodemodel.JVar in project androidannotations by androidannotations.
the class KeyEventCallbackMethodsDelegate method createOnKeyDownMethod.
private void createOnKeyDownMethod() {
JMethod method = getGeneratedClass().method(PUBLIC, codeModel().BOOLEAN, "onKeyDown");
method.annotate(Override.class);
JVar keyCode = method.param(codeModel().INT, "keyCode");
onKeyDownKeyEventParam = method.param(getClasses().KEY_EVENT, "keyEvent");
JBlock methodBody = method.body();
onKeyDownSwitchBody = methodBody._switch(keyCode);
methodBody._return(_super().invoke(method).arg(keyCode).arg(onKeyDownKeyEventParam));
}
use of com.helger.jcodemodel.JVar in project androidannotations by androidannotations.
the class APTCodeModelHelper method copy.
public void copy(JBlock body, JBlock newBody) {
for (Object statement : body.getContents()) {
if (statement instanceof JVar) {
JVar var = (JVar) statement;
try {
Field varInitField = JVar.class.getDeclaredField("m_aInitExpr");
varInitField.setAccessible(true);
IJExpression varInit = (IJExpression) varInitField.get(var);
newBody.decl(var.type(), var.name(), varInit);
} catch (Exception e) {
throw new RuntimeException(e);
}
} else {
newBody.add((IJStatement) statement);
}
}
}
use of com.helger.jcodemodel.JVar in project androidannotations by androidannotations.
the class EActivityHolder method setContentViewMethod.
private JMethod setContentViewMethod(AbstractJType[] paramTypes, String[] paramNames) {
JMethod method = generatedClass.method(JMod.PUBLIC, getCodeModel().VOID, "setContentView");
method.annotate(Override.class);
List<JVar> params = new ArrayList<>();
for (int i = 0; i < paramTypes.length; i++) {
JVar param = method.param(paramTypes[i], paramNames[i]);
params.add(param);
}
JBlock body = method.body();
JInvocation superCall = body.invoke(JExpr._super(), method);
for (JVar arg : params) {
superCall.arg(arg);
}
viewNotifierHelper.invokeViewChanged(body);
return method;
}
use of com.helger.jcodemodel.JVar in project androidannotations by androidannotations.
the class EBeanHolder method createRebindMethod.
public void createRebindMethod() {
JMethod rebindMethod = generatedClass.method(PUBLIC, getCodeModel().VOID, "rebind");
JVar contextParam = rebindMethod.param(getClasses().CONTEXT, "context");
JBlock body = rebindMethod.body();
body.assign(getContextField(), contextParam);
body.invoke(getInit());
}
Aggregations