类 FreemarkerUtil

java.lang.Object
com.tlcsdm.core.util.FreemarkerUtil

public class FreemarkerUtil extends Object
freemarker 引擎工具
作者:
unknowIfGuestInDream
  • 字段详细资料

    • configuration

      private static freemarker.template.Configuration configuration
    • IS_INIT

      private static final AtomicBoolean IS_INIT
      最开始设计是用于防止用户手动调用init方法 但是重启功能可能会重复调用, 目前此参数保留,也可以去除。
  • 构造器详细资料

    • FreemarkerUtil

      private FreemarkerUtil()
  • 方法详细资料

    • init

      public static freemarker.template.Configuration init()
      初始化, 仅供TemplateLoaderScanner调用
    • configuration

      public static freemarker.template.Configuration configuration()
      用于获取configuration 对象
    • getTemplate

      public static freemarker.template.Template getTemplate(String name)
    • getTemplate

      public static freemarker.template.Template getTemplate(freemarker.template.Configuration conf, String name)
    • getTemplateContent

      public static String getTemplateContent(Map<String,Object> objectMap, String name)
    • getTemplateContent

      public static String getTemplateContent(freemarker.template.Configuration conf, Map<String,Object> objectMap, String name)
    • getTemplateContent

      public static String getTemplateContent(String name)
    • getTemplateContent

      public static String getTemplateContent(freemarker.template.Configuration conf, String name)
    • generateFileByFile

      public static void generateFileByFile(String templateFilePath, String destFilePath, freemarker.template.Configuration configuration, Map<String,Object> model) throws IOException, freemarker.template.TemplateException
      参数:
      templateFilePath -
      destFilePath -
      configuration -
      model -
      抛出:
      IOException
      freemarker.template.TemplateException
    • generateFileByFile

      public static void generateFileByFile(String templateFilePath, String destFilePath, freemarker.template.Configuration configuration, Map<String,Object> model, boolean override) throws IOException, freemarker.template.TemplateException
      参数:
      templateFilePath -
      destFilePath -
      configuration -
      model -
      override -
      抛出:
      IOException
      freemarker.template.TemplateException
    • generateFileByFile

      public static void generateFileByFile(String templateFilePath, String destFilePath, freemarker.template.Configuration configuration, Map<String,Object> model, boolean override, boolean append) throws IOException, freemarker.template.TemplateException
      参数:
      templateFilePath -
      destFilePath -
      configuration -
      model -
      override -
      append -
      抛出:
      IOException
      freemarker.template.TemplateException
    • generateStringByFile

      public static String generateStringByFile(String template, freemarker.template.Configuration configuration) throws IOException, freemarker.template.TemplateException
      参数:
      template -
      configuration -
      返回:
      render result
      抛出:
      IOException
      freemarker.template.TemplateException
    • generateStringByFile

      public static String generateStringByFile(String template, freemarker.template.Configuration configuration, Map<String,Object> model) throws IOException, freemarker.template.TemplateException
      参数:
      template -
      configuration -
      model -
      返回:
      render result
      抛出:
      IOException
      freemarker.template.TemplateException
    • generateStringByFile

      public static void generateStringByFile(Writer writer, String template, freemarker.template.Configuration configuration, Map<String,Object> model) throws IOException, freemarker.template.TemplateException
      参数:
      writer -
      template -
      configuration -
      model -
      抛出:
      IOException
      freemarker.template.TemplateException
    • generateStringByString

      public static String generateStringByString(String templateContent, freemarker.template.Configuration configuration, Map<String,Object> model) throws IOException, freemarker.template.TemplateException
      参数:
      templateContent -
      configuration -
      model -
      返回:
      render result
      抛出:
      IOException
      freemarker.template.TemplateException