use of com.helger.jcodemodel.JMethod in project androidannotations by androidannotations.
the class EActivityHolder method setOnOptionsItemSelected.
private void setOnOptionsItemSelected() {
JMethod method = generatedClass.method(JMod.PUBLIC, getCodeModel().BOOLEAN, "onOptionsItemSelected");
method.annotate(Override.class);
JBlock methodBody = method.body();
onOptionsItemSelectedItem = method.param(getClasses().MENU_ITEM, "item");
onOptionsItemSelectedItemId = methodBody.decl(getCodeModel().INT, "itemId_", onOptionsItemSelectedItem.invoke("getItemId"));
onOptionsItemSelectedMiddleBlock = methodBody.blockSimple();
methodBody._return(invoke(_super(), method).arg(onOptionsItemSelectedItem));
}
use of com.helger.jcodemodel.JMethod in project androidannotations by androidannotations.
the class EActivityHolder method setFindNativeFragmentByTag.
@Override
protected void setFindNativeFragmentByTag() {
JMethod method = generatedClass.method(PRIVATE, getClasses().FRAGMENT, "findNativeFragmentByTag");
JVar tagParam = method.param(getClasses().STRING, "tag");
JBlock body = method.body();
body._return(invoke("getFragmentManager").invoke("findFragmentByTag").arg(tagParam));
findNativeFragmentByTag = method;
}
use of com.helger.jcodemodel.JMethod in project androidannotations by androidannotations.
the class EApplicationHolder method createOnCreate.
private void createOnCreate() {
JMethod onCreate = generatedClass.method(PUBLIC, getCodeModel().VOID, "onCreate");
onCreate.annotate(Override.class);
JBlock onCreateBody = onCreate.body();
onCreateBody.assign(staticInstanceField, _this());
onCreateBody.invoke(getInit());
onCreateBody.invoke(_super(), onCreate);
}
use of com.helger.jcodemodel.JMethod in project androidannotations by androidannotations.
the class RoboGuiceHandler method getScopedObjectMap.
private void getScopedObjectMap(EActivityHolder holder, JFieldVar scopedObjectMap) {
JMethod getScopedObjectMapMethod = holder.getGeneratedClass().method(JMod.PUBLIC, scopedObjectMap.type(), "getScopedObjectMap");
getScopedObjectMapMethod.annotate(Override.class);
getScopedObjectMapMethod.body()._return(scopedObjectMap);
}
use of com.helger.jcodemodel.JMethod in project androidannotations by androidannotations.
the class RestHolder method implementSetBearerAuth.
private void implementSetBearerAuth(List<ExecutableElement> methods) {
JMethod setBearerMethod = codeModelHelper.implementMethod(this, methods, "setBearerAuth", TypeKind.VOID.toString(), true, STRING);
if (setBearerMethod != null) {
JVar tokenParamVar = setBearerMethod.params().get(0);
IJExpression tokenExpr = lit("Bearer ").plus(tokenParamVar);
AbstractJClass authClass = getJClass(HTTP_AUTHENTICATION);
JDefinedClass anonymousHttpAuthClass = getCodeModel().anonymousClass(authClass);
JMethod getHeaderValueMethod = anonymousHttpAuthClass.method(JMod.PUBLIC, String.class, "getHeaderValue");
getHeaderValueMethod.annotate(Override.class);
JBlock getHeaderValueMethodBody = getHeaderValueMethod.body();
getHeaderValueMethodBody._return(tokenExpr);
JBlock setBearerBody = setBearerMethod.body();
setBearerBody.assign(_this().ref(getAuthenticationField()), _new(anonymousHttpAuthClass));
}
}
Aggregations