Search in sources :

Example 11 with JMethod

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

the class PreferencesDelegate method setAddPreferencesFromResourceBlock.

private void setAddPreferencesFromResourceBlock() {
    JMethod method = getGeneratedClass().method(PUBLIC, codeModel().VOID, "addPreferencesFromResource");
    method.annotate(Override.class);
    JVar preferencesResIdParam = method.param(int.class, "preferencesResId");
    method.body().invoke(JExpr._super(), "addPreferencesFromResource").arg(preferencesResIdParam);
    addPreferencesFromResourceInjectionBlock = method.body().blockVirtual();
    addPreferencesFromResourceAfterInjectionBlock = method.body().blockVirtual();
}
Also used : JMethod(com.helger.jcodemodel.JMethod) JVar(com.helger.jcodemodel.JVar)

Example 12 with JMethod

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

the class EProviderHolder method createOnCreate.

private void createOnCreate() {
    JMethod onCreate = generatedClass.method(PUBLIC, getCodeModel().BOOLEAN, "onCreate");
    onCreate.annotate(Override.class);
    JBlock onCreateBody = onCreate.body();
    onCreateBody.invoke(getInit());
    onCreateBody._return(invoke(_super(), onCreate));
}
Also used : JBlock(com.helger.jcodemodel.JBlock) JMethod(com.helger.jcodemodel.JMethod)

Example 13 with JMethod

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

the class EServiceHolder method setOnCreate.

private void setOnCreate() {
    JMethod onCreate = generatedClass.method(PUBLIC, getCodeModel().VOID, "onCreate");
    onCreate.annotate(Override.class);
    JBlock onCreateBody = onCreate.body();
    onCreateBody.invoke(getInit());
    onCreateBody.invoke(JExpr._super(), onCreate);
}
Also used : JBlock(com.helger.jcodemodel.JBlock) JMethod(com.helger.jcodemodel.JMethod)

Example 14 with JMethod

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

the class InstanceStateDelegate method setSaveStateMethod.

private void setSaveStateMethod() {
    JMethod method = getGeneratedClass().method(PUBLIC, codeModel().VOID, "onSaveInstanceState");
    method.annotate(Override.class);
    saveStateBundleParam = method.param(getClasses().BUNDLE, "bundle" + generationSuffix());
    saveStateMethodBody = method.body();
    saveStateMethodBody.invoke(JExpr._super(), "onSaveInstanceState").arg(saveStateBundleParam);
}
Also used : JMethod(com.helger.jcodemodel.JMethod)

Example 15 with JMethod

use of com.helger.jcodemodel.JMethod 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));
}
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