本文整理了Java中freemarker.core.Environment.getLazyImports()
方法的一些代码示例,展示了Environment.getLazyImports()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.getLazyImports()
方法的具体详情如下:
包路径:freemarker.core.Environment
类名称:Environment
方法名:getLazyImports
暂无
代码示例来源:origin: org.freemarker/freemarker
/**
* Emulates <code>import</code> directive, except that <code>templateName</code> must be template root relative.
*
* <p>
* It's the same as <code>importLib(getTemplateForImporting(templateName), 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.
*
* <p>
* If it will be a lazy or an eager import is decided by the value of {@link #getLazyImports()}. You
* can also directly control that aspect by using {@link #importLib(String, String, boolean)} instead.
*
* @return Not {@code null}. This is possibly a lazily self-initializing namespace, which means that it will only
* try to get and process the imported template when you access its content.
*
* @see #getTemplateForImporting(String templateName)
* @see #importLib(Template includedTemplate, String namespaceVarName)
* @see #importLib(String, String, boolean)
*/
public Namespace importLib(String templateName, String targetNsVarName)
throws IOException, TemplateException {
return importLib(templateName, targetNsVarName, getLazyImports());
}
代码示例来源:origin: org.freemarker/freemarker
private void doAutoImports(Environment env, Template t) throws IOException, TemplateException {
Map<String, String> envAutoImports = env.getAutoImportsWithoutFallback();
Map<String, String> tAutoImports = t.getAutoImportsWithoutFallback();
boolean lazyAutoImports = env.getLazyAutoImports() != null ? env.getLazyAutoImports().booleanValue()
: env.getLazyImports();
for (Map.Entry<String, String> autoImport : getAutoImportsWithoutFallback().entrySet()) {
String nsVarName = autoImport.getKey();
if ((tAutoImports == null || !tAutoImports.containsKey(nsVarName))
&& (envAutoImports == null || !envAutoImports.containsKey(nsVarName))) {
env.importLib(autoImport.getValue(), nsVarName, lazyAutoImports);
}
}
if (tAutoImports != null) {
for (Map.Entry<String, String> autoImport : tAutoImports.entrySet()) {
String nsVarName = autoImport.getKey();
if (envAutoImports == null || !envAutoImports.containsKey(nsVarName)) {
env.importLib(autoImport.getValue(), nsVarName, lazyAutoImports);
}
}
}
if (envAutoImports != null) {
for (Map.Entry<String, String> autoImport : envAutoImports.entrySet()) {
String nsVarName = autoImport.getKey();
env.importLib(autoImport.getValue(), nsVarName, lazyAutoImports);
}
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
/**
* Emulates <code>import</code> directive, except that <code>templateName</code> must be template root relative.
*
* <p>
* It's the same as <code>importLib(getTemplateForImporting(templateName), 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.
*
* <p>
* If it will be a lazy or an eager import is decided by the value of {@link #getLazyImports()}. You
* can also directly control that aspect by using {@link #importLib(String, String, boolean)} instead.
*
* @return Not {@code null}. This is possibly a lazily self-initializing namespace, which means that it will only
* try to get and process the imported template when you access its content.
*
* @see #getTemplateForImporting(String templateName)
* @see #importLib(Template includedTemplate, String namespaceVarName)
* @see #importLib(String, String, boolean)
*/
public Namespace importLib(String templateName, String targetNsVarName)
throws IOException, TemplateException {
return importLib(templateName, targetNsVarName, getLazyImports());
}
代码示例来源:origin: org.freemarker/freemarker-gae
/**
* Emulates <code>import</code> directive, except that <code>templateName</code> must be template root relative.
*
* <p>
* It's the same as <code>importLib(getTemplateForImporting(templateName), 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.
*
* <p>
* If it will be a lazy or an eager import is decided by the value of {@link #getLazyImports()}. You
* can also directly control that aspect by using {@link #importLib(String, String, boolean)} instead.
*
* @return Not {@code null}. This is possibly a lazily self-initializing namespace, which means that it will only
* try to get and process the imported template when you access its content.
*
* @see #getTemplateForImporting(String templateName)
* @see #importLib(Template includedTemplate, String namespaceVarName)
* @see #importLib(String, String, boolean)
*/
public Namespace importLib(String templateName, String targetNsVarName)
throws IOException, TemplateException {
return importLib(templateName, targetNsVarName, getLazyImports());
}
代码示例来源:origin: org.freemarker/freemarker-gae
private void doAutoImports(Environment env, Template t) throws IOException, TemplateException {
Map<String, String> envAutoImports = env.getAutoImportsWithoutFallback();
Map<String, String> tAutoImports = t.getAutoImportsWithoutFallback();
boolean lazyAutoImports = env.getLazyAutoImports() != null ? env.getLazyAutoImports().booleanValue()
: env.getLazyImports();
for (Map.Entry<String, String> autoImport : getAutoImportsWithoutFallback().entrySet()) {
String nsVarName = autoImport.getKey();
if ((tAutoImports == null || !tAutoImports.containsKey(nsVarName))
&& (envAutoImports == null || !envAutoImports.containsKey(nsVarName))) {
env.importLib(autoImport.getValue(), nsVarName, lazyAutoImports);
}
}
if (tAutoImports != null) {
for (Map.Entry<String, String> autoImport : tAutoImports.entrySet()) {
String nsVarName = autoImport.getKey();
if (envAutoImports == null || !envAutoImports.containsKey(nsVarName)) {
env.importLib(autoImport.getValue(), nsVarName, lazyAutoImports);
}
}
}
if (envAutoImports != null) {
for (Map.Entry<String, String> autoImport : envAutoImports.entrySet()) {
String nsVarName = autoImport.getKey();
env.importLib(autoImport.getValue(), nsVarName, lazyAutoImports);
}
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
private void doAutoImports(Environment env, Template t) throws IOException, TemplateException {
Map<String, String> envAutoImports = env.getAutoImportsWithoutFallback();
Map<String, String> tAutoImports = t.getAutoImportsWithoutFallback();
boolean lazyAutoImports = env.getLazyAutoImports() != null ? env.getLazyAutoImports().booleanValue()
: env.getLazyImports();
for (Map.Entry<String, String> autoImport : getAutoImportsWithoutFallback().entrySet()) {
String nsVarName = autoImport.getKey();
if ((tAutoImports == null || !tAutoImports.containsKey(nsVarName))
&& (envAutoImports == null || !envAutoImports.containsKey(nsVarName))) {
env.importLib(autoImport.getValue(), nsVarName, lazyAutoImports);
}
}
if (tAutoImports != null) {
for (Map.Entry<String, String> autoImport : tAutoImports.entrySet()) {
String nsVarName = autoImport.getKey();
if (envAutoImports == null || !envAutoImports.containsKey(nsVarName)) {
env.importLib(autoImport.getValue(), nsVarName, lazyAutoImports);
}
}
}
if (envAutoImports != null) {
for (Map.Entry<String, String> autoImport : envAutoImports.entrySet()) {
String nsVarName = autoImport.getKey();
env.importLib(autoImport.getValue(), nsVarName, lazyAutoImports);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!