Package freemarker.template

Examples of freemarker.template.DefaultObjectWrapper


  public void testFreeMarker() throws Exception{
    Configuration cfg = new Configuration();
    // 指定模板从何处加载的数据源,这里设置成一个文件目录。
    cfg.setDirectoryForTemplateLoading(new File("src/test/java/test/ftl"));
    // 指定模板如何检索数据模型
    cfg.setObjectWrapper(new DefaultObjectWrapper());
   
    Map root = new HashMap();
    root.put("user", "Big Joe");
    Map latest = new HashMap();
    root.put("latestProduct", latest);
View Full Code Here


  }

  static String freemarker () throws Exception {
    Configuration cfg = new Configuration();
    cfg.setDefaultEncoding("UTF-8");
    cfg.setObjectWrapper(new DefaultObjectWrapper());
    cfg.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER);
    cfg.setDirectoryForTemplateLoading(new File("templates"));

    HashMap hash = new HashMap();
    hash.put("a", "ABCD");
View Full Code Here

   */
  private void writeReport() throws IOException {
    Configuration cfg = new Configuration();
    cfg.setClassForTemplateLoading(RTexResultReportRenderer.class, "/"
        + templateDirectory);
    cfg.setObjectWrapper(new DefaultObjectWrapper());

    Map<String, Object> dataMap = prepareDataMap();
    Template basicTemplate = cfg.getTemplate(templateFileName);

    try (Writer out =
View Full Code Here

    public TemplateEngine(RDFBackend<Node> backend) {

        this.backend = backend;

        freemarker = new Configuration();
        freemarker.setObjectWrapper(new DefaultObjectWrapper());


    }
View Full Code Here

        /* You should do this ONLY ONCE in the whole application life-cycle:       */   
   
        /* Create and adjust the configuration */
      
        this.cfg.setDirectoryForTemplateLoading(new File("templates/")); //$NON-NLS-1$
        this.cfg.setObjectWrapper(new DefaultObjectWrapper());
        this.cfg.setDefaultEncoding("UTF-8"); //$NON-NLS-1$
        this.cfg.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER);
        this.cfg.setIncompatibleImprovements(new Version(2, 3, 20));

        /* ----------------------------------------------------------------------- */   
View Full Code Here

            Configuration cfg = new Configuration();
            // Specify the data source where the template files come from.
            cfg.setDirectoryForTemplateLoading(settingsDir);
            // Specify how templates will see the data-model. This is an advanced topic...
            cfg.setObjectWrapper(new DefaultObjectWrapper());

            myWorkUnits = computeWorkUnits();

            List<Map<String, String>> groups = new ArrayList<Map<String, String>>();
            Set<String> seenDocumentationFeatures = new HashSet<String>();
View Full Code Here

  public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    final TypeElement element = env.getElementUtils().getTypeElement(Entity.class.getName());
    if (annotations.contains(element)) {
      try {
        Configuration cfg = new Configuration();
        cfg.setObjectWrapper(new DefaultObjectWrapper());
        cfg.setTemplateLoader(new ClassTemplateLoader(getClass(), "/templates"));
        Template template = cfg.getTemplate("criteria.ftl");
        for (TypeElement typeElement : ElementFilter.typesIn(roundEnv.getElementsAnnotatedWith(Entity.class))) {
          generate(template, typeElement);
        }
View Full Code Here

                    new File(directoryPath));
       } catch (IOException e) {
           throw new RuntimeException(e);
       }

        cfg.setObjectWrapper(new DefaultObjectWrapper());
    }
View Full Code Here

        try {
            cfg.setDirectoryForTemplateLoading(DataUtilities.urlToFile(templateDirectory));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        cfg.setObjectWrapper(new DefaultObjectWrapper());
    }
View Full Code Here

        try {
            templateCfg.setDirectoryForTemplateLoading(templatesPath);
        } catch (IOException e) {
            e.printStackTrace();
        }
        templateCfg.setObjectWrapper(new DefaultObjectWrapper());
    }
View Full Code Here

TOP

Related Classes of freemarker.template.DefaultObjectWrapper

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.