private Statement setProducerInstanceReference() { return controller.setReferenceStmt(PRODUCER_INSTANCE, loadVariable(PRODUCER_INSTANCE)); }
@Override public void generateDecorator(final Decorable decorable, final FactoryController controller) { final List<Statement> statements = new ArrayList<Statement>(); if (decorable.getDecorableDeclaringType().isAnnotationPresent(RestrictedAccess.class)) { final RestrictedAccess annotation = decorable.getDecorableDeclaringType().getAnnotation(RestrictedAccess.class); final String roleListenerVar = "roleListener"; statements.add(controller.setReferenceStmt(roleListenerVar, Stmt.newObject(PageRoleLifecycleListener.class, annotation, Stmt.newObject(ClientRequiredRolesExtractorImpl.class)))); Statement roleListenerRef = controller.getReferenceStmt(roleListenerVar, PageRoleLifecycleListener.class); statements.add(Stmt.invokeStatic(IOC.class, "registerLifecycleListener", Refs.get("instance"), roleListenerRef)); controller.addInitializationStatements(statements); controller.addDestructionStatements(Collections.<Statement> singletonList(Stmt.invokeStatic(IOC.class, "unregisterLifecycleListener", Refs.get("instance"), roleListenerRef))); } }
@Override public void generateDecorator(final Decorable decorable, final FactoryController controller) { final List<Statement> statements = new ArrayList<Statement>(); if (decorable.getDecorableDeclaringType().isAnnotationPresent(RestrictedAccess.class)) { final RestrictedAccess annotation = decorable.getDecorableDeclaringType().getAnnotation(RestrictedAccess.class); final String roleListenerVar = "roleListener"; statements.add(controller.setReferenceStmt(roleListenerVar, Stmt.newObject(PageRoleLifecycleListener.class, annotation, Stmt.newObject(ClientRequiredRolesExtractorImpl.class)))); Statement roleListenerRef = controller.getReferenceStmt(roleListenerVar, PageRoleLifecycleListener.class); statements.add(Stmt.invokeStatic(IOC.class, "registerLifecycleListener", Refs.get("instance"), roleListenerRef)); controller.addInitializationStatements(statements); controller.addDestructionStatements(Collections.<Statement> singletonList(Stmt.invokeStatic(IOC.class, "unregisterLifecycleListener", Refs.get("instance"), roleListenerRef))); } }
@Override public void generateDecorator(final Decorable decorable, final FactoryController controller) { final MetaMethod method = validateExceptionHandlingMethod(decorable); final boolean enclosingTypeDependent = decorable.isEnclosingTypeDependent(); final String handlerVar = method.getName() + "Handler"; final String cleanupRunnableVar = method.getName() + "HandlerCleanup"; final Statement setCleanupRefStmt = controller.setReferenceStmt(cleanupRunnableVar, Refs.get(cleanupRunnableVar)); final Statement getCleanupRefStmt = controller.getReferenceStmt(cleanupRunnableVar, Runnable.class); final List<Statement> initStmts = new ArrayList<>(Arrays.asList( declareAndInitHandlerVar(decorable, controller, handlerVar, enclosingTypeDependent), declareFinalVariable(cleanupRunnableVar, Runnable.class, addHandler(handlerVar)))); if (enclosingTypeDependent) { initStmts.add(setCleanupRefStmt); } final List<Statement> destructionStmts = Collections.singletonList(nestedCall(getCleanupRefStmt).invoke("run")); if (enclosingTypeDependent) { controller.addInitializationStatements(initStmts); controller.addDestructionStatements(destructionStmts); } else { controller.addFactoryInitializationStatements(initStmts); } }
controller.addInitializationStatements( Collections.<Statement>singletonList( controller.setReferenceStmt(MODEL_VAR_NAME, DecorableType.PARAM.getAccessStatement(mp, decorable.getFactoryMetaClass())))); dataBinderRef = controller.getInstancePropertyStmt( controller.getReferenceStmt(MODEL_VAR_NAME, dataModelType), BINDER_VAR_NAME,
controller.addInitializationStatements( Collections.<Statement>singletonList( controller.setReferenceStmt(MODEL_VAR_NAME, DecorableType.PARAM.getAccessStatement(mp, decorable.getFactoryMetaClass())))); dataBinderRef = controller.getInstancePropertyStmt( controller.getReferenceStmt(MODEL_VAR_NAME, dataModelType), BINDER_VAR_NAME,
controller.addInitializationStatements(Collections.<Statement>singletonList(controller.setReferenceStmt(varName, subscribeStatement))); controller.addDestructionStatements(Collections.<Statement> singletonList( Stmt.nestedCall(controller.getReferenceStmt(varName, Subscription.class)).invoke("remove")));
controller.addInitializationStatements(Collections.<Statement>singletonList(controller.setReferenceStmt(varName, subscribeStatement))); controller.addDestructionStatements(Collections.<Statement> singletonList( Stmt.nestedCall(controller.getReferenceStmt(varName, Subscription.class)).invoke("remove")));
QueryParamInitCallback.class, queryParamCallback.finish().finish())); statements.add(controller.setReferenceStmt("syncWorker", Stmt.invokeStatic(ClientSyncWorker.class, "create", syncAnnotation.query(), Stmt.loadVariable("objectClass"), null)));
final List<Statement> destructionStmts = new ArrayList<Statement>(); initStmts.add(controller.setReferenceStmt(timerVarName, timerDecl));
controller.setAttribute(DATA_BINDING_CONFIG_ATTR, Boolean.TRUE); initStmts.add(controller.setReferenceStmt(handlerVarName, newObject(StyleBindingChangeHandler.class))); initStmts.add(controller.setReferenceStmt("styleBindingChangeHandlerUnsub", nestedCall(dataBinder.getValueAccessor()).invoke("addPropertyChangeHandler", controller.getReferenceStmt(handlerVarName, StyleBindingChangeHandler.class))));
controller.setAttribute(DATA_BINDING_CONFIG_ATTR, Boolean.TRUE); initStmts.add(controller.setReferenceStmt(handlerVarName, newObject(StyleBindingChangeHandler.class))); initStmts.add(controller.setReferenceStmt("styleBindingChangeHandlerUnsub", nestedCall(dataBinder.getValueAccessor()).invoke("addPropertyChangeHandler", controller.getReferenceStmt(handlerVarName, StyleBindingChangeHandler.class))));
initStatements.add(controller.setReferenceStmt(subscrVar, subscribeStatement)); destroyStatements.add(controller.getReferenceStmt(subscrVar, Subscription.class).invoke("remove")); } else { if (isEnclosingTypeDependent) { final String subscrHandle = subscrVar + "For" + cls.getSimpleName(); initStatements.add(controller.setReferenceStmt(subscrHandle, routingSubStmt)); destroyStatements.add( Stmt.nestedCall(controller.getReferenceStmt(subscrHandle, Subscription.class)).invoke("remove"));
bindExecStmts.add(controller.setReferenceStmt(registrationHandleVar, loadVariable(hanldeVarName))); bindExecStmts.add(decorable.getAccessStatement(elementAccessor));
bindExecStmts.add(controller.setReferenceStmt(registrationHandleVar, loadVariable(hanldeVarName))); bindExecStmts.add(decorable.getAccessStatement(elementAccessor));
+ targetClass + " has not been initialized. Either initialize or add @Inject!")).finish()); statements.add(controller.setReferenceStmt(DataBindingUtil.BINDER_VAR_NAME, loadVariable("binder")));
+ targetClass + " has not been initialized. Either initialize or add @Inject!")).finish()); statements.add(controller.setReferenceStmt(DataBindingUtil.BINDER_VAR_NAME, loadVariable("binder")));