Package com.github.mustachejava

Examples of com.github.mustachejava.Mustache


  }

  private String render(Class<?> templateClass, Context context) {
    try {

      Mustache mustache = mustaches.compile(templateClass);

      StringWriter writer = new StringWriter();
      Map<?, ?> scope = toMustacheScope(context);

      Writer execute = mustache.execute(writer, scope);
      execute.flush();

      return writer.toString();

    } catch (IOException e) {
View Full Code Here


        try {
            final ClassLoader loader = FunctorCompiler.class.getClassLoader();
            thread.setContextClassLoader(loader);

            final MustacheFactory factory = new DefaultMustacheFactory();
            final Mustache mustache = factory.compile("templates/template.mustache");

            try {
                final Filer filer = processingEnv.getFiler();
                final JavaFileObject file = filer.createSourceFile(type.getName().getQualified());

                try (Writer writer = file.openWriter()) {
                    mustache.execute(writer, type).flush();
                }
            } catch (IOException e) {
                throw new IllegalArgumentException(e);
            }
        } finally {
View Full Code Here

    try {
      URL url = getTemplateUri().toURL();
      InputStreamReader reader = new InputStreamReader(url.openStream(),
          Charset.forName("UTF-8"));
      Mustache mustache = getMustacheFactory().compile(reader,
          templatePath);

      mustache.execute(writer, outputTemplate).flush();
      writer.close();
      LOG.info("Done!");
    } catch (MalformedURLException e) {
      throw new GenerateException(e);
    } catch (IOException e) {
View Full Code Here

TOP

Related Classes of com.github.mustachejava.Mustache

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.