java.lang.Object
com.tlcsdm.core.util.FreemarkerUtil
freemarker 引擎工具
- 作者:
- unknowIfGuestInDream
-
字段概要
字段修饰符和类型字段说明private static freemarker.template.Configurationprivate static final AtomicBoolean最开始设计是用于防止用户手动调用init方法 但是重启功能可能会重复调用, 目前此参数保留,也可以去除。 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static freemarker.template.Configuration用于获取configuration 对象static voidgenerateFileByFile(String templateFilePath, String destFilePath, freemarker.template.Configuration configuration, Map<String, Object> model) static voidgenerateFileByFile(String templateFilePath, String destFilePath, freemarker.template.Configuration configuration, Map<String, Object> model, boolean override) static voidgenerateFileByFile(String templateFilePath, String destFilePath, freemarker.template.Configuration configuration, Map<String, Object> model, boolean override, boolean append) static voidgenerateStringByFile(Writer writer, String template, freemarker.template.Configuration configuration, Map<String, Object> model) static StringgenerateStringByFile(String template, freemarker.template.Configuration configuration) static StringgenerateStringByFile(String template, freemarker.template.Configuration configuration, Map<String, Object> model) static StringgenerateStringByString(String templateContent, freemarker.template.Configuration configuration, Map<String, Object> model) static freemarker.template.TemplategetTemplate(freemarker.template.Configuration conf, String name) static freemarker.template.TemplategetTemplate(String name) static StringgetTemplateContent(freemarker.template.Configuration conf, String name) static StringgetTemplateContent(freemarker.template.Configuration conf, Map<String, Object> objectMap, String name) static StringgetTemplateContent(String name) static StringgetTemplateContent(Map<String, Object> objectMap, String name) static freemarker.template.Configurationinit()初始化, 仅供TemplateLoaderScanner调用
-
字段详细资料
-
configuration
private static freemarker.template.Configuration configuration -
IS_INIT
最开始设计是用于防止用户手动调用init方法 但是重启功能可能会重复调用, 目前此参数保留,也可以去除。
-
-
构造器详细资料
-
FreemarkerUtil
private FreemarkerUtil()
-
-
方法详细资料
-
init
public static freemarker.template.Configuration init()初始化, 仅供TemplateLoaderScanner调用 -
configuration
public static freemarker.template.Configuration configuration()用于获取configuration 对象 -
getTemplate
-
getTemplate
public static freemarker.template.Template getTemplate(freemarker.template.Configuration conf, String name) -
getTemplateContent
-
getTemplateContent
-
getTemplateContent
-
getTemplateContent
-
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-- 抛出:
IOExceptionfreemarker.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-- 抛出:
IOExceptionfreemarker.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-- 抛出:
IOExceptionfreemarker.template.TemplateException
-
generateStringByFile
public static String generateStringByFile(String template, freemarker.template.Configuration configuration) throws IOException, freemarker.template.TemplateException - 参数:
template-configuration-- 返回:
- render result
- 抛出:
IOExceptionfreemarker.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
- 抛出:
IOExceptionfreemarker.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-- 抛出:
IOExceptionfreemarker.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
- 抛出:
IOExceptionfreemarker.template.TemplateException
-