@Override protected Element[] getElements(TemplateMetaModel template) { return new Element[]{application.getProcessingContext().get(application.getHandle())}; }
@Override public void postProcessEvents(ApplicationMetaModel application) { // Do GC ElementHandle.Package pkg = application.getHandle(); String[] names = enabledMap.get(pkg); if (names != null) { PackageElement pkgElt = application.model.processingContext.get(pkg); AnnotationMirror am = Tools.getAnnotation(pkgElt, Portlet.class.getName()); if (am == null) { enabledMap.remove(pkg); toEmit.remove(pkg); } else { if (toEmit.contains(pkg)) { toEmit.remove(pkg); emitPortlet(application.model.processingContext, pkgElt, names); } } } }
@Override public void postProcessEvents(ApplicationMetaModel application) { // Do GC ElementHandle.Package pkg = application.getHandle(); String[] names = enabledMap.get(pkg); if (names != null) { PackageElement pkgElt = application.model.processingContext.get(pkg); AnnotationMirror am = Tools.getAnnotation(pkgElt, Portlet.class.getName()); if (am == null) { enabledMap.remove(pkg); toEmit.remove(pkg); } else { if (toEmit.contains(pkg)) { toEmit.remove(pkg); emitPortlet(application.model.processingContext, pkgElt, names); } } } }
@Override protected Element[] getElements(TemplateMetaModel template) { return new Element[]{application.getProcessingContext().get(application.getHandle())}; }
for (Map.Entry<AnnotationKey, AnnotationState> entry : knownAnnotations.entrySet()) { AnnotationKey key = entry.getKey(); Element element = processingContext.get(key.element); if (element == null) { delta.add(new AnnotationChange(key, entry.getValue(), null));
void emitApplication(ProcessingContext env, ApplicationMetaModel application) throws ProcessingException { PackageElement elt = env.get(application.getHandle()); Name fqn = application.getName().append("Application");
void emitApplication(ProcessingContext env, ApplicationMetaModel application) throws ProcessingException { PackageElement elt = env.get(application.getHandle()); Name fqn = application.getName().append("Application");
for (Map.Entry<AnnotationKey, AnnotationState> entry : knownAnnotations.entrySet()) { AnnotationKey key = entry.getKey(); Element element = processingContext.get(key.element); if (element == null) { delta.add(new AnnotationChange(key, entry.getValue(), null));
AnnotationState annotation = servlets.remove(pkg); if (annotation != null) { PackageElement pkgElt = metaModel.processingContext.get(pkg); String urlPattern = (String)annotation.get("value"); String simpleName = (String)annotation.get("name");
TypeElement controllerElt = application.getProcessingContext().get(controller.getHandle()); if (controllerElt.getModifiers().contains(Modifier.ABSTRACT)) { throw ControllerMetaModel.CONTROLLER_IS_ABSTRACT.failure(controllerElt, controller.handle.getName());
TypeElement controllerElt = application.getProcessingContext().get(controller.getHandle()); if (controllerElt.getModifiers().contains(Modifier.ABSTRACT)) { throw ControllerMetaModel.CONTROLLER_IS_ABSTRACT.failure(controllerElt, controller.handle.getName());
ExecutableElement methodElt = context.processingContext.get(methodHandle); ProcessingContext.log.log(Level.FINE, "Adding method " + methodElt + " to controller class " + handle);
ExecutableElement methodElt = context.processingContext.get(methodHandle); ProcessingContext.log.log(Level.FINE, "Adding method " + methodElt + " to controller class " + handle);
private void processBundle(ApplicationMetaModel application, ElementHandle.Package pkg, String bundleName) { ProcessingContext context = application.getProcessingContext(); PackageElement pkgElt = context.get(pkg); Properties properties = loadBundle(context, pkg, bundleName); if (properties == null) { throw BUNDLE_NOT_FOUND.failure(pkgElt, bundleName); } else { try { generateBundleClass(context, properties, pkgElt, bundleName); } catch (IOException e) { throw CANNOT_CREATE_BUNDLE.failure(pkgElt, bundleName).initCause(e); } } } // end::processBundle[]
Integer priority = (Integer)annotation.get("priority"); HashMap<String, ParamDescriptor> parameters = null; ExecutableElement exe = metaModel.processingContext.get(method.getMethod()); for (VariableElement ve : exe.getParameters()) { Param param = ve.getAnnotation(Param.class);
private void processBundle(ApplicationMetaModel application, ElementHandle.Package pkg, String bundleName) { ProcessingContext context = application.getProcessingContext(); PackageElement pkgElt = context.get(pkg); Properties properties = loadBundle(context, pkg, bundleName); if (properties == null) { throw BUNDLE_NOT_FOUND.failure(pkgElt, bundleName); } else { try { generateBundleClass(context, properties, pkgElt, bundleName); } catch (IOException e) { throw CANNOT_CREATE_BUNDLE.failure(pkgElt, bundleName).initCause(e); } } } // end::processBundle[]
@Override public void init(ApplicationMetaModel application) { ControllersMetaModel controllers = new ControllersMetaModel(this); PackageElement pkg = application.model.processingContext.get(application.getHandle()); AnnotationMirror annotation = Tools.getAnnotation(pkg, Application.class.getName()); AnnotationState values = AnnotationState.create(annotation); Boolean escapeXML = (Boolean)values.get("escapeXML"); ElementHandle.Type defaultControllerElt = (ElementHandle.Type)values.get("defaultController"); ElementHandle.Type errorControllerElt = (ElementHandle.Type)values.get("errorController"); controllers.escapeXML = escapeXML; controllers.defaultController = defaultControllerElt != null ? defaultControllerElt.getName() : null; controllers.errorController = errorControllerElt != null ? errorControllerElt.getName() : null; application.addChild(ControllersMetaModel.KEY, controllers); }
@Override public void init(ApplicationMetaModel application) { ControllersMetaModel controllers = new ControllersMetaModel(this); PackageElement pkg = application.model.processingContext.get(application.getHandle()); AnnotationMirror annotation = Tools.getAnnotation(pkg, Application.class.getName()); AnnotationState values = AnnotationState.create(annotation); Boolean escapeXML = (Boolean)values.get("escapeXML"); ElementHandle.Type defaultControllerElt = (ElementHandle.Type)values.get("defaultController"); ElementHandle.Type errorControllerElt = (ElementHandle.Type)values.get("errorController"); controllers.escapeXML = escapeXML; controllers.defaultController = defaultControllerElt != null ? defaultControllerElt.getName() : null; controllers.errorController = errorControllerElt != null ? errorControllerElt.getName() : null; application.addChild(ControllersMetaModel.KEY, controllers); }
throw ApplicationMetaModel.CANNOT_WRITE_APPLICATION_CONFIG.failure(e, metaModel.processingContext.get(application.getHandle()), application.getName());
throw ApplicationMetaModel.CANNOT_WRITE_APPLICATION_CONFIG.failure(e, metaModel.processingContext.get(application.getHandle()), application.getName());