Search in sources :

Example 36 with JMethod

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

the class EFragmentHolder method setOnAttach.

private void setOnAttach() {
    JMethod onAttach = generatedClass.method(PUBLIC, getCodeModel().VOID, "onAttach");
    onAttach.annotate(Override.class);
    JVar activityParam = onAttach.param(getClasses().ACTIVITY, "activity");
    JBlock onAttachBody = onAttach.body();
    onAttachBody.invoke(_super(), onAttach).arg(activityParam);
    onAttachAfterSuperBlock = onAttachBody.blockSimple();
}
Also used : JBlock(com.helger.jcodemodel.JBlock) JMethod(com.helger.jcodemodel.JMethod) JVar(com.helger.jcodemodel.JVar)

Example 37 with JMethod

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

the class EFragmentHolder method setOnCreateView.

private void setOnCreateView() {
    JMethod onCreateView = generatedClass.method(PUBLIC, getClasses().VIEW, "onCreateView");
    onCreateView.annotate(Override.class);
    inflater = onCreateView.param(getClasses().LAYOUT_INFLATER, "inflater");
    container = onCreateView.param(getClasses().VIEW_GROUP, "container");
    JVar savedInstanceState = onCreateView.param(getClasses().BUNDLE, "savedInstanceState");
    boolean forceInjection = getAnnotatedElement().getAnnotation(EFragment.class).forceLayoutInjection();
    JBlock body = onCreateView.body();
    if (!forceInjection) {
        body.assign(contentView, _super().invoke(onCreateView).arg(inflater).arg(container).arg(savedInstanceState));
    }
    setContentViewBlock = body.blockSimple();
    body._return(contentView);
}
Also used : JBlock(com.helger.jcodemodel.JBlock) EFragment(org.androidannotations.annotations.EFragment) JMethod(com.helger.jcodemodel.JMethod) JVar(com.helger.jcodemodel.JVar)

Example 38 with JMethod

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

the class EFragmentHolder method setOnDetach.

private void setOnDetach() {
    JMethod onDetach = generatedClass.method(PUBLIC, getCodeModel().VOID, "onDetach");
    onDetach.annotate(Override.class);
    JBlock onDetachBody = onDetach.body();
    onDetachBeforeSuperBlock = onDetachBody.blockSimple();
    onDetachBody.invoke(_super(), onDetach);
}
Also used : JBlock(com.helger.jcodemodel.JBlock) JMethod(com.helger.jcodemodel.JMethod)

Example 39 with JMethod

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

the class EFragmentHolder method setOnStart.

private void setOnStart() {
    JMethod onStart = generatedClass.method(PUBLIC, getCodeModel().VOID, "onStart");
    onStart.annotate(Override.class);
    JBlock onStartBody = onStart.body();
    onStartBody.invoke(_super(), onStart);
    onStartAfterSuperBlock = onStartBody.blockSimple();
}
Also used : JBlock(com.helger.jcodemodel.JBlock) JMethod(com.helger.jcodemodel.JMethod)

Example 40 with JMethod

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

the class EFragmentHolder method setOnViewCreated.

private void setOnViewCreated() {
    JMethod onViewCreated = generatedClass.method(PUBLIC, getCodeModel().VOID, "onViewCreated");
    onViewCreated.annotate(Override.class);
    JVar view = onViewCreated.param(getClasses().VIEW, "view");
    JVar savedInstanceState = onViewCreated.param(getClasses().BUNDLE, "savedInstanceState");
    JBlock onViewCreatedBody = onViewCreated.body();
    onViewCreatedBody.invoke(_super(), onViewCreated).arg(view).arg(savedInstanceState);
    viewNotifierHelper.invokeViewChanged(onViewCreatedBody);
}
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