code: protected StringBuffer generate(String template, Supplier<Map<String, Object>> context) {
          final StringWriter sw = new StringWriter();
          final BufferedWriter bw = new BufferedWriter(sw);
          try {
              final Template t = config.getTemplate(template);
              t.process(context.get(), bw);
          } catch (IOException | TemplateException ioe) {
              throw new GenerationException("Error generating template " + template + ": " + ioe.getMessage());
          } finally {
              try {
                  bw.close();
                  sw.close();
              } catch (IOException ioe) {
                  //noinspection ThrowFromFinallyBlock
                  throw new GenerationException("Error generating template " + template + ": " + ioe.getMessage());
              }
          }
          return sw.getBuffer();
      }
docs: Generates the code using the specified context and freemarker template. Wraps any kind of error inside a
  {@code GenerationException}.
  
  @param template the relative template name (w/o path or package name)
  @param context  a function to create the templates' context
  @return the generated content