protected StringBuffer writeTemplate(final Map<String, Object> ctxt, final String path) throws GenerationException { //Generate code final StringWriter sw = new StringWriter(); final BufferedWriter bw = new BufferedWriter(sw); try { final Template template = config.getTemplate(path + ".ftl"); template.process(ctxt, bw); } catch (IOException ioe) { throw new GenerationException(ioe); } catch (TemplateException te) { throw new GenerationException(te); } finally { try { bw.close(); sw.close(); } catch (IOException ioe) { throw new GenerationException(ioe); } } return sw.getBuffer(); }
protected StringBuffer writeTemplate(final String packageName, final String className, final Map<String, Object> ctxt, final Messager messager) throws GenerationException { //Generate code final StringWriter sw = new StringWriter(); final BufferedWriter bw = new BufferedWriter(sw); try { final Template template = config.getTemplate(getTemplatePath()); template.process(ctxt, bw); } catch (IOException ioe) { throw new GenerationException(ioe); } catch (TemplateException te) { throw new GenerationException(te); } finally { try { bw.close(); sw.close(); } catch (IOException ioe) { throw new GenerationException(ioe); } } messager.printMessage(Diagnostic.Kind.NOTE, "Successfully generated code for [" + packageName + "." + className + "]"); return sw.getBuffer(); }
bw); } catch (IOException ioe) { throw new GenerationException(ioe); } catch (TemplateException te) { throw new GenerationException(te); } finally { try { sw.close(); } catch (IOException ioe) { throw new GenerationException(ioe);
bw); } catch (IOException | TemplateException ioe) { throw new GenerationException(ioe); } finally { try { sw.close(); } catch (IOException ioe) { throw new GenerationException(ioe);
bw); } catch (IOException ioe) { throw new GenerationException(ioe); } catch (TemplateException te) { throw new GenerationException(te); } finally { try { sw.close(); } catch (IOException ioe) { throw new GenerationException(ioe);
bw); } catch (IOException | TemplateException ioe) { throw new GenerationException(ioe); } finally { try { sw.close(); } catch (IOException ioe) { throw new GenerationException(ioe);
throw new GenerationException(te);
throw new GenerationException("Multiple methods with @" + fqcnToSimpleName(annotationName) + " detected.");
throw new GenerationException("Multiple methods with @" + fqcnToSimpleName(annotationName) + " detected.");
throw new GenerationException("Multiple methods with @" + fqcnToSimpleName(annotationName) + " detected.");
throw new GenerationException("Multiple methods with @" + fqcnToSimpleName(annotationName) + " detected.");
throw new GenerationException("Multiple methods with @" + fqcnToSimpleName(annotationName) + " detected.");
throw new GenerationException("Multiple methods with @" + fqcnToSimpleName(annotationName) + " detected.");
throw new GenerationException(te);
throw new GenerationException("Multiple methods with @" + fqcnToSimpleName(annotationName) + " detected.");
throw new GenerationException("Multiple methods with @" + fqcnToSimpleName(annotationName) + " detected.");
throw new GenerationException("Multiple methods with @" + fqcnToSimpleName(annotationName) + " detected.");
private static void extractInformationFromWorkbenchPanel(Elements elementUtils, TemplateInformation template, Element element) throws GenerationException { if (GeneratorUtils.getAnnotation(elementUtils, element, ClientAPIModule.getWorkbenchPanel()) == null) { // this element is not of interest return; } WorkbenchPanelInformation wbPanel = new WorkbenchPanelInformation(); if (workbenchPanelIsDefault(elementUtils, element)) { wbPanel.setDefault(true); } wbPanel.setFieldName(element.getSimpleName().toString()); wbPanel.setWbParts(getWorkbenchPartsFrom(elementUtils, element)); wbPanel.setPanelType(extractPanelType(elementUtils, element)); if (wbPanel.isDefault()) { if (template.getDefaultPanel() != null) { throw new GenerationException("Found more than one @WorkbenchPanel with isDefault=true."); } template.setDefaultPanel(wbPanel); } else { template.addTemplateField(wbPanel); } }
private static void extractInformationFromWorkbenchPanel(Elements elementUtils, TemplateInformation template, Element element) throws GenerationException { if (GeneratorUtils.getAnnotation(elementUtils, element, ClientAPIModule.getWorkbenchPanel()) == null) { // this element is not of interest return; } WorkbenchPanelInformation wbPanel = new WorkbenchPanelInformation(); if (workbenchPanelIsDefault(elementUtils, element)) { wbPanel.setDefault(true); } wbPanel.setFieldName(element.getSimpleName().toString()); wbPanel.setWbParts(getWorkbenchPartsFrom(elementUtils, element)); wbPanel.setPanelType(extractPanelType(elementUtils, element)); if (wbPanel.isDefault()) { if (template.getDefaultPanel() != null) { throw new GenerationException("Found more than one @WorkbenchPanel with isDefault=true."); } template.setDefaultPanel(wbPanel); } else { template.addTemplateField(wbPanel); } }