本文整理了Java中freemarker.core.Environment.getTemplateForImporting()
方法的一些代码示例,展示了Environment.getTemplateForImporting()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.getTemplateForImporting()
方法的具体详情如下:
包路径:freemarker.core.Environment
类名称:Environment
方法名:getTemplateForImporting
[英]Gets a template for importing; used with #importLib(Template importedTemplate,String namespace). The advantage over simply using config.getTemplate(...)
is that it chooses the encoding as the import
directive does.
[中]
代码示例来源:origin: org.freemarker/freemarker
/**
* Like {@link #importLib(String, String)}, but you can specify if you want a
* {@linkplain #setLazyImports(boolean) lazy import} or not.
*
* @return Not {@code null}. This is possibly a lazily self-initializing namespace, which mean that it will only try
* to get and process the imported template when you access its content.
*
* @since 2.3.25
*/
public Namespace importLib(String templateName, String targetNsVarName, boolean lazy)
throws IOException, TemplateException {
return lazy
? importLib(templateName, null, targetNsVarName)
: importLib(null, getTemplateForImporting(templateName), targetNsVarName);
}
代码示例来源:origin: org.freemarker/com.springsource.freemarker
/**
* Emulates <code>import</code> directive, except that <code>name</code> must be tempate
* root relative.
*
* <p>It's the same as <code>importLib(getTemplateForImporting(name), namespace)</code>.
* But, you may want to separately call these two methods, so you can determine the source of
* exceptions more precisely, and thus achieve more intelligent error handling.
*
* @see #getTemplateForImporting(String name)
* @see #importLib(Template includedTemplate, String namespace)
*/
public Namespace importLib(String name, String namespace)
throws IOException, TemplateException
{
return importLib(getTemplateForImporting(name), namespace);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
/**
* Like {@link #importLib(String, String)}, but you can specify if you want a
* {@linkplain #setLazyImports(boolean) lazy import} or not.
*
* @return Not {@code null}. This is possibly a lazily self-initializing namespace, which mean that it will only try
* to get and process the imported template when you access its content.
*
* @since 2.3.25
*/
public Namespace importLib(String templateName, String targetNsVarName, boolean lazy)
throws IOException, TemplateException {
return lazy
? importLib(templateName, null, targetNsVarName)
: importLib(null, getTemplateForImporting(templateName), targetNsVarName);
}
代码示例来源:origin: org.freemarker/freemarker-gae
/**
* Like {@link #importLib(String, String)}, but you can specify if you want a
* {@linkplain #setLazyImports(boolean) lazy import} or not.
*
* @return Not {@code null}. This is possibly a lazily self-initializing namespace, which mean that it will only try
* to get and process the imported template when you access its content.
*
* @since 2.3.25
*/
public Namespace importLib(String templateName, String targetNsVarName, boolean lazy)
throws IOException, TemplateException {
return lazy
? importLib(templateName, null, targetNsVarName)
: importLib(null, getTemplateForImporting(templateName), targetNsVarName);
}
代码示例来源:origin: org.freemarker/com.springsource.freemarker
importedTemplate = env.getTemplateForImporting(templateNameString);
内容来源于网络,如有侵权,请联系作者删除!