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())); } } }
template.setAutoIncludes(mergeLists(getAutoIncludes(), template.getAutoIncludesWithoutFallback()));
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())); } } }
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())); } } }
template.setAutoIncludes(mergeLists(getAutoIncludes(), template.getAutoIncludesWithoutFallback()));
template.setAutoIncludes(mergeLists(getAutoIncludes(), template.getAutoIncludesWithoutFallback()));