Search in sources :

Example 11 with JBlock

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

the class EActivityHolder method setOnStop.

private void setOnStop() {
    onStopMethod = generatedClass.method(JMod.PUBLIC, getCodeModel().VOID, "onStop");
    onStopMethod.annotate(Override.class);
    JBlock body = onStopMethod.body();
    onStopBeforeSuperBlock = body.blockSimple();
    body.invoke(_super(), onStopMethod);
}
Also used : JBlock(com.helger.jcodemodel.JBlock)

Example 12 with JBlock

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

the class EActivityHolder method setFindSupportFragmentByTag.

@Override
protected void setFindSupportFragmentByTag() {
    JMethod method;
    if (getProcessingEnvironment().getElementUtils().getTypeElement(CanonicalNameConstants.ANDROIDX_FRAGMENT) == null) {
        method = getGeneratedClass().method(PRIVATE, getClasses().SUPPORT_V4_FRAGMENT, "findSupportFragmentByTag");
    } else {
        method = getGeneratedClass().method(PRIVATE, getClasses().ANDROIDX_FRAGMENT, "findSupportFragmentByTag");
    }
    JVar tagParam = method.param(getClasses().STRING, "tag");
    JBlock body = method.body();
    body._return(invoke("getSupportFragmentManager").invoke("findFragmentByTag").arg(tagParam));
    findSupportFragmentByTag = method;
}
Also used : JBlock(com.helger.jcodemodel.JBlock) JMethod(com.helger.jcodemodel.JMethod) JVar(com.helger.jcodemodel.JVar)

Example 13 with JBlock

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

the class EActivityHolder method setOnConfigurationChanged.

private void setOnConfigurationChanged() {
    JMethod method = generatedClass.method(JMod.PUBLIC, getCodeModel().VOID, "onConfigurationChanged");
    method.annotate(Override.class);
    AbstractJClass configurationClass = getClasses().CONFIGURATION;
    onConfigurationChangedNewConfigParam = method.param(configurationClass, "newConfig");
    JBlock body = method.body();
    onConfigurationChangedBeforeSuperBlock = body.blockSimple();
    body.invoke(_super(), method).arg(onConfigurationChangedNewConfigParam);
    onConfigurationChangedAfterSuperBlock = body.blockSimple();
}
Also used : JBlock(com.helger.jcodemodel.JBlock) AbstractJClass(com.helger.jcodemodel.AbstractJClass) JMethod(com.helger.jcodemodel.JMethod)

Example 14 with JBlock

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

the class EActivityHolder method setOnResume.

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

Example 15 with JBlock

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

the class EFragmentHolder method setInjectArgs.

private void setInjectArgs() {
    injectArgsMethod = generatedClass.method(PRIVATE, getCodeModel().VOID, "injectFragmentArguments" + generationSuffix());
    JBlock injectExtrasBody = injectArgsMethod.body();
    injectBundleArgs = injectExtrasBody.decl(getClasses().BUNDLE, "args_", invoke("getArguments"));
    injectArgsBlock = injectExtrasBody._if(injectBundleArgs.ne(_null()))._then();
    getInitBodyInjectionBlock().invoke(injectArgsMethod);
}
Also used : JBlock(com.helger.jcodemodel.JBlock)

Aggregations

JBlock (com.helger.jcodemodel.JBlock)155 JVar (com.helger.jcodemodel.JVar)86 JMethod (com.helger.jcodemodel.JMethod)75 AbstractJClass (com.helger.jcodemodel.AbstractJClass)40 JInvocation (com.helger.jcodemodel.JInvocation)38 IJExpression (com.helger.jcodemodel.IJExpression)31 ExecutableElement (javax.lang.model.element.ExecutableElement)26 JFieldRef (com.helger.jcodemodel.JFieldRef)19 JDefinedClass (com.helger.jcodemodel.JDefinedClass)15 VariableElement (javax.lang.model.element.VariableElement)15 JFieldVar (com.helger.jcodemodel.JFieldVar)13 TypeMirror (javax.lang.model.type.TypeMirror)13 JConditional (com.helger.jcodemodel.JConditional)10 JTryBlock (com.helger.jcodemodel.JTryBlock)9 JCatchBlock (com.helger.jcodemodel.JCatchBlock)4 TypeElement (javax.lang.model.element.TypeElement)3 PageChangeHolder (org.androidannotations.holder.PageChangeHolder)3 AbstractJType (com.helger.jcodemodel.AbstractJType)2 IJAssignmentTarget (com.helger.jcodemodel.IJAssignmentTarget)2 IJStatement (com.helger.jcodemodel.IJStatement)2