@Override public JStatement buildWriter(JExpression extras, String name, JVar extraParam) { JInvocation wrappedParcel = generationUtil .ref(IntentFactoryStrategyGenerator.PARCELS_NAME) .staticInvoke(IntentFactoryStrategyGenerator.WRAP_METHOD) .arg(extraParam); return extras.invoke("putParcelable").arg(name).arg(wrappedParcel); }
public TypedExpression buildVariable( InjectionBuilderContext injectionBuilderContext, InjectionNode injectionNode) { // build provider JDefinedClass providerClass = providerGenerator.generateProvider(injectionNode, true); JExpression provider = JExpr._new(providerClass).arg(injectionBuilderContext.getScopeVar()); // build scope call // <T> T getScopedObject(Class<T> clazz, Provider<T> provider); TypedExpression contextScopeHolderExpression = injectionExpressionBuilder.buildVariable(injectionBuilderContext, this.contextScopeHolder); JExpression cast = invocationHelper.coerceType(ContextScopeHolder.class, contextScopeHolderExpression); JExpression scopeVar = cast.invoke(ContextScopeHolder.GET_SCOPE); JExpression expression = scopeVar.invoke(Scope.GET_SCOPED_OBJECT).arg(buildScopeKey(injectionNode)).arg(provider); return typedExpressionFactory.build(injectionNode.getASTType(), expression); }
@Override public void buildLayoutCall(JDefinedClass definedClass, JBlock block) { try { Map<InjectionNode, TypedExpression> expressionMap = injectionFragmentGenerator.buildFragment(block, definedClass, layoutHandlerInjectionNode); // LayoutHandlerDelegate.invokeLayout() JExpression layoutHandlerDelegate = expressionMap.get(layoutHandlerInjectionNode).getExpression(); block.add(layoutHandlerDelegate.invoke(LayoutHandlerDelegate.INVOKE_LAYOUT_METHOD)); } catch (ClassNotFoundException e) { logger.error("ClassNotFoundException while trying to generate LayoutHandler", e); } catch (JClassAlreadyExistsException e) { logger.error("JClassAlreadyExistsException while trying to generate LayoutHandler", e); } }