use of com.helger.jcodemodel.AbstractJClass in project androidannotations by androidannotations.
the class EActivityHolder method setOnCreate.
private void setOnCreate() {
onCreate = generatedClass.method(PUBLIC, getCodeModel().VOID, "onCreate");
onCreate.annotate(Override.class);
AbstractJClass bundleClass = getClasses().BUNDLE;
JVar onCreateSavedInstanceState = onCreate.param(bundleClass, "savedInstanceState");
JBlock onCreateBody = onCreate.body();
JVar previousNotifier = viewNotifierHelper.replacePreviousNotifier(onCreateBody);
onCreateBody.invoke(getInit()).arg(onCreateSavedInstanceState);
onCreateBody.invoke(_super(), onCreate).arg(onCreateSavedInstanceState);
viewNotifierHelper.resetPreviousNotifier(onCreateBody, previousNotifier);
}
use of com.helger.jcodemodel.AbstractJClass in project androidannotations by androidannotations.
the class RoboGuiceHandler method fireEvent.
private void fireEvent(JFieldVar eventManager, JBlock body, AbstractJClass eventClass, IJExpression... eventArguments) {
AbstractJClass actualEventClass = eventClass;
if (eventClass.fullName().startsWith("roboguice.context.event")) {
actualEventClass = eventClass.narrow(getClasses().ACTIVITY);
}
JInvocation newEvent = _new(actualEventClass);
newEvent.arg(_this());
for (IJExpression eventArgument : eventArguments) {
newEvent.arg(eventArgument);
}
body.invoke(eventManager, "fire").arg(newEvent);
}
use of com.helger.jcodemodel.AbstractJClass in project androidannotations by androidannotations.
the class RoboGuiceHolder method getScopedObjectsField.
public JFieldVar getScopedObjectsField() {
if (scopedObjects == null) {
AbstractJClass keyWildCard = getJClass(RoboGuiceClasses.KEY).narrow(getCodeModel().wildcard());
AbstractJClass scopedHashMap = environment().getClasses().HASH_MAP.narrow(keyWildCard, environment().getClasses().OBJECT);
scopedObjects = getGeneratedClass().field(JMod.PROTECTED, scopedHashMap, "scopedObjects" + generationSuffix());
scopedObjects.assign(JExpr._new(scopedHashMap));
}
return scopedObjects;
}
use of com.helger.jcodemodel.AbstractJClass in project androidannotations by androidannotations.
the class RestHolder method implementSetBearerAuth.
private void implementSetBearerAuth(List<ExecutableElement> methods) {
JMethod setBearerMethod = codeModelHelper.implementMethod(this, methods, "setBearerAuth", TypeKind.VOID.toString(), true, STRING);
if (setBearerMethod != null) {
JVar tokenParamVar = setBearerMethod.params().get(0);
IJExpression tokenExpr = lit("Bearer ").plus(tokenParamVar);
AbstractJClass authClass = getJClass(HTTP_AUTHENTICATION);
JDefinedClass anonymousHttpAuthClass = getCodeModel().anonymousClass(authClass);
JMethod getHeaderValueMethod = anonymousHttpAuthClass.method(JMod.PUBLIC, String.class, "getHeaderValue");
getHeaderValueMethod.annotate(Override.class);
JBlock getHeaderValueMethodBody = getHeaderValueMethod.body();
getHeaderValueMethodBody._return(tokenExpr);
JBlock setBearerBody = setBearerMethod.body();
setBearerBody.assign(_this().ref(getAuthenticationField()), _new(anonymousHttpAuthClass));
}
}
use of com.helger.jcodemodel.AbstractJClass in project androidannotations by androidannotations.
the class RestHolder method setRestErrorHandlerField.
private void setRestErrorHandlerField() {
AbstractJClass restErrorHandlerClass = getJClass(RestErrorHandler.class.getName());
restErrorHandlerField = getGeneratedClass().field(JMod.PRIVATE, restErrorHandlerClass, "restErrorHandler");
}
Aggregations