freemarker.template.Configuration.getAutoIncludesWithoutFallback()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(103)

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

Configuration.getAutoIncludesWithoutFallback介绍

暂无

代码示例

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

private void doAutoIncludes(Environment env, Template t) throws TemplateException, IOException,
    TemplateNotFoundException, MalformedTemplateNameException, ParseException {
  // We can't store autoIncludes in LinkedHashSet-s because setAutoIncludes(List) allows duplicates,
  // unfortunately. Yet we have to prevent duplicates among Configuration levels, with the lowest levels having
  // priority. So we build some Set-s to do that, but we avoid the most common cases where they aren't needed.
  
  List<String> tAutoIncludes = t.getAutoIncludesWithoutFallback();
  List<String> envAutoIncludes = env.getAutoIncludesWithoutFallback();
  
  for (String templateName : getAutoIncludesWithoutFallback()) {
    if ((tAutoIncludes == null || !tAutoIncludes.contains(templateName))
        && (envAutoIncludes == null || !envAutoIncludes.contains(templateName))) {
      env.include(getTemplate(templateName, env.getLocale()));
    }
  }
  
  if (tAutoIncludes != null) {
    for (String templateName : tAutoIncludes) {
      if (envAutoIncludes == null || !envAutoIncludes.contains(templateName)) {
        env.include(getTemplate(templateName, env.getLocale()));
      }
    }
  }
  
  if (envAutoIncludes != null) {
    for (String templateName : envAutoIncludes) {
      env.include(getTemplate(templateName, env.getLocale()));
    }
  }
}

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

private void doAutoIncludes(Environment env, Template t) throws TemplateException, IOException,
    TemplateNotFoundException, MalformedTemplateNameException, ParseException {
  // We can't store autoIncludes in LinkedHashSet-s because setAutoIncludes(List) allows duplicates,
  // unfortunately. Yet we have to prevent duplicates among Configuration levels, with the lowest levels having
  // priority. So we build some Set-s to do that, but we avoid the most common cases where they aren't needed.
  
  List<String> tAutoIncludes = t.getAutoIncludesWithoutFallback();
  List<String> envAutoIncludes = env.getAutoIncludesWithoutFallback();
  
  for (String templateName : getAutoIncludesWithoutFallback()) {
    if ((tAutoIncludes == null || !tAutoIncludes.contains(templateName))
        && (envAutoIncludes == null || !envAutoIncludes.contains(templateName))) {
      env.include(getTemplate(templateName, env.getLocale()));
    }
  }
  
  if (tAutoIncludes != null) {
    for (String templateName : tAutoIncludes) {
      if (envAutoIncludes == null || !envAutoIncludes.contains(templateName)) {
        env.include(getTemplate(templateName, env.getLocale()));
      }
    }
  }
  
  if (envAutoIncludes != null) {
    for (String templateName : envAutoIncludes) {
      env.include(getTemplate(templateName, env.getLocale()));
    }
  }
}

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

private void doAutoIncludes(Environment env, Template t) throws TemplateException, IOException,
    TemplateNotFoundException, MalformedTemplateNameException, ParseException {
  // We can't store autoIncludes in LinkedHashSet-s because setAutoIncludes(List) allows duplicates,
  // unfortunately. Yet we have to prevent duplicates among Configuration levels, with the lowest levels having
  // priority. So we build some Set-s to do that, but we avoid the most common cases where they aren't needed.
  
  List<String> tAutoIncludes = t.getAutoIncludesWithoutFallback();
  List<String> envAutoIncludes = env.getAutoIncludesWithoutFallback();
  
  for (String templateName : getAutoIncludesWithoutFallback()) {
    if ((tAutoIncludes == null || !tAutoIncludes.contains(templateName))
        && (envAutoIncludes == null || !envAutoIncludes.contains(templateName))) {
      env.include(getTemplate(templateName, env.getLocale()));
    }
  }
  
  if (tAutoIncludes != null) {
    for (String templateName : tAutoIncludes) {
      if (envAutoIncludes == null || !envAutoIncludes.contains(templateName)) {
        env.include(getTemplate(templateName, env.getLocale()));
      }
    }
  }
  
  if (envAutoIncludes != null) {
    for (String templateName : envAutoIncludes) {
      env.include(getTemplate(templateName, env.getLocale()));
    }
  }
}

相关文章

Configuration类方法