Search in sources :

Example 71 with JMethod

use of com.helger.jcodemodel.JMethod in project androidannotations by androidannotations.

the class EActivityHolder method setOnCreateOptionsMenu.

private void setOnCreateOptionsMenu() {
    JMethod method = generatedClass.method(PUBLIC, getCodeModel().BOOLEAN, "onCreateOptionsMenu");
    method.annotate(Override.class);
    JBlock methodBody = method.body();
    onCreateOptionsMenuMenuParam = method.param(getClasses().MENU, "menu");
    onCreateOptionsMenuMenuInflaterVar = methodBody.decl(getClasses().MENU_INFLATER, "menuInflater", invoke("getMenuInflater"));
    onCreateOptionsMenuMethodInflateBody = methodBody.blockSimple();
    onCreateOptionsMenuMethodBody = methodBody.blockSimple();
    methodBody._return(_super().invoke(method).arg(onCreateOptionsMenuMenuParam));
}
Also used : JBlock(com.helger.jcodemodel.JBlock) JMethod(com.helger.jcodemodel.JMethod)

Example 72 with JMethod

use of com.helger.jcodemodel.JMethod in project androidannotations by androidannotations.

the class EActivityHolder method setOnPause.

private void setOnPause() {
    JMethod method = generatedClass.method(JMod.PUBLIC, getCodeModel().VOID, "onPause");
    method.annotate(Override.class);
    JBlock body = method.body();
    onPauseBeforeSuperBlock = body.blockSimple();
    body.invoke(_super(), method);
    onPauseAfterSuperBlock = body.blockSimple();
}
Also used : JBlock(com.helger.jcodemodel.JBlock) JMethod(com.helger.jcodemodel.JMethod)

Example 73 with JMethod

use of com.helger.jcodemodel.JMethod in project androidannotations by androidannotations.

the class EActivityHolder method setFindSupportFragmentById.

@Override
protected void setFindSupportFragmentById() {
    JMethod method = generatedClass.method(PRIVATE, getClasses().SUPPORT_V4_FRAGMENT, "findSupportFragmentById");
    JVar idParam = method.param(getCodeModel().INT, "id");
    JBlock body = method.body();
    body._return(invoke("getSupportFragmentManager").invoke("findFragmentById").arg(idParam));
    findSupportFragmentById = method;
}
Also used : JBlock(com.helger.jcodemodel.JBlock) JMethod(com.helger.jcodemodel.JMethod) JVar(com.helger.jcodemodel.JVar)

Example 74 with JMethod

use of com.helger.jcodemodel.JMethod in project androidannotations by androidannotations.

the class EActivityHolder method setOnRestart.

private void setOnRestart() {
    JMethod method = generatedClass.method(JMod.PUBLIC, getCodeModel().VOID, "onRestart");
    method.annotate(Override.class);
    JBlock body = method.body();
    onRestartBeforeSuperBlock = body.blockSimple();
    body.invoke(_super(), method);
    onRestartAfterSuperBlock = body.blockSimple();
}
Also used : JBlock(com.helger.jcodemodel.JBlock) JMethod(com.helger.jcodemodel.JMethod)

Example 75 with JMethod

use of com.helger.jcodemodel.JMethod in project androidannotations by androidannotations.

the class EActivityHolder method setFindNativeFragmentById.

@Override
protected void setFindNativeFragmentById() {
    JMethod method = generatedClass.method(PRIVATE, getClasses().FRAGMENT, "findNativeFragmentById");
    JVar idParam = method.param(getCodeModel().INT, "id");
    JBlock body = method.body();
    body._return(invoke("getFragmentManager").invoke("findFragmentById").arg(idParam));
    findNativeFragmentById = method;
}
Also used : JBlock(com.helger.jcodemodel.JBlock) JMethod(com.helger.jcodemodel.JMethod) JVar(com.helger.jcodemodel.JVar)

Aggregations

JMethod (com.helger.jcodemodel.JMethod)122 JBlock (com.helger.jcodemodel.JBlock)73 JVar (com.helger.jcodemodel.JVar)56 AbstractJClass (com.helger.jcodemodel.AbstractJClass)36 JInvocation (com.helger.jcodemodel.JInvocation)26 JDefinedClass (com.helger.jcodemodel.JDefinedClass)20 IJExpression (com.helger.jcodemodel.IJExpression)15 ExecutableElement (javax.lang.model.element.ExecutableElement)13 JFieldVar (com.helger.jcodemodel.JFieldVar)10 JConditional (com.helger.jcodemodel.JConditional)8 JTryBlock (com.helger.jcodemodel.JTryBlock)7 JTypeVar (com.helger.jcodemodel.JTypeVar)7 TypeMirror (javax.lang.model.type.TypeMirror)7 VariableElement (javax.lang.model.element.VariableElement)6 JFieldRef (com.helger.jcodemodel.JFieldRef)5 JPrimitiveType (com.helger.jcodemodel.JPrimitiveType)5 ArrayList (java.util.ArrayList)5 VisitorDefinition (com.github.sviperll.adt4j.model.config.VisitorDefinition)4 GenerationProcess (com.github.sviperll.adt4j.model.util.GenerationProcess)4 AbstractJType (com.helger.jcodemodel.AbstractJType)4