use of com.helger.jcodemodel.JInvocation in project androidannotations by androidannotations.
the class EReceiverHolder method setOnReceiveIntentDataScheme.
private void setOnReceiveIntentDataScheme() {
JInvocation getDataSchemeInvocation = JExpr.invoke(getOnReceiveIntent(), "getScheme");
onReceiveIntentDataScheme = getOnReceiveBody().decl(getClasses().STRING, "dataScheme", getDataSchemeInvocation);
}
use of com.helger.jcodemodel.JInvocation in project androidannotations by androidannotations.
the class EReceiverHolder method setOnReceiveIntentAction.
private void setOnReceiveIntentAction() {
JInvocation getActionInvocation = JExpr.invoke(getOnReceiveIntent(), "getAction");
onReceiveIntentAction = getOnReceiveBody().decl(getClasses().STRING, "action", getActionInvocation);
}
use of com.helger.jcodemodel.JInvocation in project androidannotations by androidannotations.
the class EViewHolder method createConstructorAndBuilder.
private void createConstructorAndBuilder() {
List<ExecutableElement> constructors = new ArrayList<>();
for (Element e : annotatedElement.getEnclosedElements()) {
if (e.getKind() == CONSTRUCTOR) {
constructors.add((ExecutableElement) e);
}
}
for (ExecutableElement userConstructor : constructors) {
JMethod copyConstructor = generatedClass.constructor(PUBLIC);
JMethod staticHelper = generatedClass.method(PUBLIC | STATIC, generatedClass._extends(), "build");
codeModelHelper.generify(staticHelper, getAnnotatedElement());
JBlock body = copyConstructor.body();
JInvocation superCall = body.invoke("super");
AbstractJClass narrowedGeneratedClass = narrow(generatedClass);
JInvocation newInvocation = JExpr._new(narrowedGeneratedClass);
for (VariableElement param : userConstructor.getParameters()) {
String paramName = param.getSimpleName().toString();
AbstractJClass paramType = codeModelHelper.typeMirrorToJClass(param.asType());
copyConstructor.param(paramType, paramName);
staticHelper.param(paramType, paramName);
superCall.arg(JExpr.ref(paramName));
newInvocation.arg(JExpr.ref(paramName));
}
JVar newCall = staticHelper.body().decl(narrowedGeneratedClass, "instance", newInvocation);
staticHelper.body().invoke(newCall, getOnFinishInflate());
staticHelper.body()._return(newCall);
body.invoke(getInit());
}
}
use of com.helger.jcodemodel.JInvocation in project androidannotations by androidannotations.
the class PreferencesDelegate method findPreferenceByKey.
private JInvocation findPreferenceByKey(JFieldRef idRef) {
JInvocation getString = invoke(_this(), "getString").arg(idRef);
JInvocation findPreferenceByKey = invoke(_this(), "findPreference");
return findPreferenceByKey.arg(getString);
}
use of com.helger.jcodemodel.JInvocation in project androidannotations by androidannotations.
the class EIntentServiceHolder method createOnHandleIntent.
private void createOnHandleIntent() {
onHandleIntentMethod = generatedClass.method(PUBLIC, getCodeModel().VOID, "onHandleIntent");
onHandleIntentIntent = onHandleIntentMethod.param(getClasses().INTENT, "intent");
onHandleIntentMethod.annotate(Override.class);
onHandleIntentBody = onHandleIntentMethod.body();
codeModelHelper.callSuperMethod(onHandleIntentMethod, this, onHandleIntentBody);
JInvocation getActionInvocation = JExpr.invoke(onHandleIntentIntent, "getAction");
onHandleIntentIntentAction = onHandleIntentBody.decl(getClasses().STRING, "action", getActionInvocation);
}
Aggregations