freemarker.core.Environment.getTemplateForImporting()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中freemarker.core.Environment.getTemplateForImporting()方法的一些代码示例,展示了Environment.getTemplateForImporting()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.getTemplateForImporting()方法的具体详情如下:
包路径:freemarker.core.Environment
类名称:Environment
方法名:getTemplateForImporting

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

  1. /**
  2. * Like {@link #importLib(String, String)}, but you can specify if you want a
  3. * {@linkplain #setLazyImports(boolean) lazy import} or not.
  4. *
  5. * @return Not {@code null}. This is possibly a lazily self-initializing namespace, which mean that it will only try
  6. * to get and process the imported template when you access its content.
  7. *
  8. * @since 2.3.25
  9. */
  10. public Namespace importLib(String templateName, String targetNsVarName, boolean lazy)
  11. throws IOException, TemplateException {
  12. return lazy
  13. ? importLib(templateName, null, targetNsVarName)
  14. : importLib(null, getTemplateForImporting(templateName), targetNsVarName);
  15. }

代码示例来源:origin: org.freemarker/com.springsource.freemarker

  1. /**
  2. * Emulates <code>import</code> directive, except that <code>name</code> must be tempate
  3. * root relative.
  4. *
  5. * <p>It's the same as <code>importLib(getTemplateForImporting(name), namespace)</code>.
  6. * But, you may want to separately call these two methods, so you can determine the source of
  7. * exceptions more precisely, and thus achieve more intelligent error handling.
  8. *
  9. * @see #getTemplateForImporting(String name)
  10. * @see #importLib(Template includedTemplate, String namespace)
  11. */
  12. public Namespace importLib(String name, String namespace)
  13. throws IOException, TemplateException
  14. {
  15. return importLib(getTemplateForImporting(name), namespace);
  16. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

  1. /**
  2. * Like {@link #importLib(String, String)}, but you can specify if you want a
  3. * {@linkplain #setLazyImports(boolean) lazy import} or not.
  4. *
  5. * @return Not {@code null}. This is possibly a lazily self-initializing namespace, which mean that it will only try
  6. * to get and process the imported template when you access its content.
  7. *
  8. * @since 2.3.25
  9. */
  10. public Namespace importLib(String templateName, String targetNsVarName, boolean lazy)
  11. throws IOException, TemplateException {
  12. return lazy
  13. ? importLib(templateName, null, targetNsVarName)
  14. : importLib(null, getTemplateForImporting(templateName), targetNsVarName);
  15. }

代码示例来源:origin: org.freemarker/freemarker-gae

  1. /**
  2. * Like {@link #importLib(String, String)}, but you can specify if you want a
  3. * {@linkplain #setLazyImports(boolean) lazy import} or not.
  4. *
  5. * @return Not {@code null}. This is possibly a lazily self-initializing namespace, which mean that it will only try
  6. * to get and process the imported template when you access its content.
  7. *
  8. * @since 2.3.25
  9. */
  10. public Namespace importLib(String templateName, String targetNsVarName, boolean lazy)
  11. throws IOException, TemplateException {
  12. return lazy
  13. ? importLib(templateName, null, targetNsVarName)
  14. : importLib(null, getTemplateForImporting(templateName), targetNsVarName);
  15. }

代码示例来源:origin: org.freemarker/com.springsource.freemarker

  1. importedTemplate = env.getTemplateForImporting(templateNameString);

相关文章

Environment类方法