Use new Java features (switch expressions, text blocks, new JDK methods)
Closes gh-29747
This commit is contained in:
committed by
Sam Brannen
parent
48abd493fe
commit
afb8a0d1b1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -389,16 +389,17 @@ public class FreeMarkerConfigurationFactory {
|
||||
*/
|
||||
@Nullable
|
||||
protected TemplateLoader getAggregateTemplateLoader(List<TemplateLoader> templateLoaders) {
|
||||
switch (templateLoaders.size()) {
|
||||
case 0:
|
||||
return switch (templateLoaders.size()) {
|
||||
case 0 -> {
|
||||
logger.debug("No FreeMarker TemplateLoaders specified");
|
||||
return null;
|
||||
case 1:
|
||||
return templateLoaders.get(0);
|
||||
default:
|
||||
yield null;
|
||||
}
|
||||
case 1 -> templateLoaders.get(0);
|
||||
default -> {
|
||||
TemplateLoader[] loaders = templateLoaders.toArray(new TemplateLoader[0]);
|
||||
return new MultiTemplateLoader(loaders);
|
||||
}
|
||||
yield new MultiTemplateLoader(loaders);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user