freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [3/3] incubator-freemarker git commit: Renamed ParserConfiguration to ParsingConfiguration, so that the name is more consistent with the new ProcessingConfiguration.
Date Fri, 14 Apr 2017 22:02:24 GMT
Renamed ParserConfiguration to ParsingConfiguration, so that the name is more consistent with
the new ProcessingConfiguration.

Some code cleanup in the configuration related parts, mostly in the JavaDoc of ProcessingConfiguration
and MutableProcessingConfiguration.


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/18a4ace8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/18a4ace8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/18a4ace8

Branch: refs/heads/3
Commit: 18a4ace82cca7bd72b1de9334b8921778970eebb
Parents: 0356b30
Author: ddekany <ddekany@apache.org>
Authored: Sat Apr 15 00:02:09 2017 +0200
Committer: ddekany <ddekany@apache.org>
Committed: Sat Apr 15 00:02:09 2017 +0200

----------------------------------------------------------------------
 .../freemarker/core/ASTExpStringLiteral.java    |   2 +-
 .../freemarker/core/BuiltInsForStringsMisc.java |   4 +-
 .../apache/freemarker/core/Configuration.java   |   2 +-
 ...utableParsingAndProcessingConfiguration.java | 354 +++++++
 .../MutableProcessingAndParseConfiguration.java | 354 -------
 .../core/MutableProcessingConfiguration.java    | 925 ++++---------------
 .../core/ParserAndProcessingConfiguration.java  |  29 -
 .../freemarker/core/ParserConfiguration.java    | 154 ---
 .../core/ParsingAndProcessingConfiguration.java |  29 +
 .../freemarker/core/ParsingConfiguration.java   | 154 +++
 .../core/ProcessingConfiguration.java           | 432 ++++++++-
 .../org/apache/freemarker/core/Template.java    |  20 +-
 .../freemarker/core/TemplateConfiguration.java  |   8 +-
 ...TemplateParserConfigurationWithFallback.java | 146 ---
 ...emplateParsingConfigurationWithFallback.java | 146 +++
 .../org/apache/freemarker/core/_EvalUtil.java   |   2 +-
 .../freemarker/core/util/_KeyValuePair.java     |  61 ++
 src/main/javacc/FTL.jj                          |   8 +-
 src/manual/en_US/FM3-CHANGE-LOG.txt             |   1 +
 .../freemarker/core/OutputFormatTest.java       |   5 +-
 .../core/TemplateConfigurationTest.java         |   2 +-
 21 files changed, 1367 insertions(+), 1471 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18a4ace8/src/main/java/org/apache/freemarker/core/ASTExpStringLiteral.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ASTExpStringLiteral.java b/src/main/java/org/apache/freemarker/core/ASTExpStringLiteral.java
index 972752a..e0363e4 100644
--- a/src/main/java/org/apache/freemarker/core/ASTExpStringLiteral.java
+++ b/src/main/java/org/apache/freemarker/core/ASTExpStringLiteral.java
@@ -54,7 +54,7 @@ final class ASTExpStringLiteral extends ASTExpression implements TemplateScalarM
         if (value.length() > 3 && (value.indexOf("${") >= 0 || value.indexOf("#{")
>= 0)) {
             
             Template parentTemplate = getTemplate();
-            ParserConfiguration pCfg = parentTemplate.getParserConfiguration();
+            ParsingConfiguration pCfg = parentTemplate.getParsingConfiguration();
 
             try {
                 SimpleCharStream simpleCharacterStream = new SimpleCharStream(

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18a4ace8/src/main/java/org/apache/freemarker/core/BuiltInsForStringsMisc.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/BuiltInsForStringsMisc.java b/src/main/java/org/apache/freemarker/core/BuiltInsForStringsMisc.java
index ae06392..b33ede0 100644
--- a/src/main/java/org/apache/freemarker/core/BuiltInsForStringsMisc.java
+++ b/src/main/java/org/apache/freemarker/core/BuiltInsForStringsMisc.java
@@ -75,7 +75,7 @@ class BuiltInsForStringsMisc {
             ASTExpression exp = null;
             try {
                 try {
-                    ParserConfiguration pCfg = parentTemplate.getParserConfiguration();
+                    ParsingConfiguration pCfg = parentTemplate.getParsingConfiguration();
                     
                     SimpleCharStream simpleCharStream = new SimpleCharStream(
                             new StringReader("(" + s + ")"),
@@ -168,7 +168,7 @@ class BuiltInsForStringsMisc {
             
             final Template interpretedTemplate;
             try {
-                ParserConfiguration pCfg = parentTemplate.getParserConfiguration();
+                ParsingConfiguration pCfg = parentTemplate.getParsingConfiguration();
                 // pCfg.outputFormat+autoEscapingPolicy is exceptional: it's inherited from
the lexical context
                 interpretedTemplate = new Template(
                         (parentTemplate.getName() != null ? parentTemplate.getName() : "nameless_template")
+ "->" + id,

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18a4ace8/src/main/java/org/apache/freemarker/core/Configuration.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/Configuration.java b/src/main/java/org/apache/freemarker/core/Configuration.java
index 5d2cd34..1a0dfa6 100644
--- a/src/main/java/org/apache/freemarker/core/Configuration.java
+++ b/src/main/java/org/apache/freemarker/core/Configuration.java
@@ -145,7 +145,7 @@ import org.apache.freemarker.core.valueformat.TemplateNumberFormatFactory;
  * The methods that aren't for modifying settings, like {@link #getTemplate(String)}, are
thread-safe.
  */
 public final class Configuration extends MutableProcessingConfiguration<Configuration>
-        implements Cloneable, ParserAndProcessingConfiguration, CustomStateScope {
+        implements Cloneable, ParsingAndProcessingConfiguration, CustomStateScope {
     
     private static final String VERSION_PROPERTIES_PATH = "org/apache/freemarker/core/version.properties";
     

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18a4ace8/src/main/java/org/apache/freemarker/core/MutableParsingAndProcessingConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/MutableParsingAndProcessingConfiguration.java
b/src/main/java/org/apache/freemarker/core/MutableParsingAndProcessingConfiguration.java
new file mode 100644
index 0000000..2df4796
--- /dev/null
+++ b/src/main/java/org/apache/freemarker/core/MutableParsingAndProcessingConfiguration.java
@@ -0,0 +1,354 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.freemarker.core;
+
+import java.io.InputStream;
+import java.nio.charset.Charset;
+
+import org.apache.freemarker.core.outputformat.OutputFormat;
+import org.apache.freemarker.core.templateresolver.TemplateLoader;
+import org.apache.freemarker.core.util._NullArgumentException;
+
+// TODO This will be the superclass of TemplateConfiguration.Builder and Configuration.Builder
+public abstract class MutableParsingAndProcessingConfiguration<
+        SelfT extends MutableParsingAndProcessingConfiguration<SelfT>>
+        extends MutableProcessingConfiguration<SelfT>
+        implements ParsingAndProcessingConfiguration {
+
+    private TemplateLanguage templateLanguage;
+    private Integer tagSyntax;
+    private Integer namingConvention;
+    private Boolean whitespaceStripping;
+    private Integer autoEscapingPolicy;
+    private Boolean recognizeStandardFileExtensions;
+    private OutputFormat outputFormat;
+    private Charset sourceEncoding;
+    private Integer tabSize;
+
+    protected MutableParsingAndProcessingConfiguration(Version incompatibleImprovements)
{
+        super(incompatibleImprovements);
+    }
+
+    protected MutableParsingAndProcessingConfiguration() {
+        super();
+    }
+
+    /**
+     * See {@link Configuration#setTagSyntax(int)}.
+     */
+    public void setTagSyntax(int tagSyntax) {
+        Configuration.valideTagSyntaxValue(tagSyntax);
+        this.tagSyntax = tagSyntax;
+    }
+
+    /**
+     * Fluent API equivalent of {@link #tagSyntax(int)}
+     */
+    public SelfT tagSyntax(int tagSyntax) {
+        setTagSyntax(tagSyntax);
+        return self();
+    }
+
+    /**
+     * The getter pair of {@link #setTagSyntax(int)}.
+     */
+    @Override
+    public int getTagSyntax() {
+        return tagSyntax != null ? tagSyntax : getInheritedTagSyntax();
+    }
+
+    protected abstract int getInheritedTagSyntax();
+
+    @Override
+    public boolean isTagSyntaxSet() {
+        return tagSyntax != null;
+    }
+
+    /**
+     * See {@link Configuration#getTemplateLanguage()}
+     */
+    @Override
+    public TemplateLanguage getTemplateLanguage() {
+         return isTemplateLanguageSet() ? templateLanguage : getInheritedTemplateLanguage();
+    }
+
+    protected abstract TemplateLanguage getInheritedTemplateLanguage();
+
+    /**
+     * See {@link Configuration#setTemplateLanguage(TemplateLanguage)}
+     */
+    public void setTemplateLanguage(TemplateLanguage templateLanguage) {
+        _NullArgumentException.check("templateLanguage", templateLanguage);
+        this.templateLanguage = templateLanguage;
+    }
+
+    /**
+     * Fluent API equivalent of {@link #setTemplateLanguage(TemplateLanguage)}
+     */
+    public SelfT templateLanguage(TemplateLanguage templateLanguage) {
+        setTemplateLanguage(templateLanguage);
+        return self();
+    }
+
+    public boolean isTemplateLanguageSet() {
+        return templateLanguage != null;
+    }
+
+    /**
+     * See {@link Configuration#setNamingConvention(int)}.
+     */
+    public void setNamingConvention(int namingConvention) {
+        Configuration.validateNamingConventionValue(namingConvention);
+        this.namingConvention = namingConvention;
+    }
+
+    /**
+     * Fluent API equivalent of {@link #setNamingConvention(int)}
+     */
+    public SelfT namingConvention(int namingConvention) {
+        setNamingConvention(namingConvention);
+        return self();
+    }
+
+    /**
+     * The getter pair of {@link #setNamingConvention(int)}.
+     */
+    @Override
+    public int getNamingConvention() {
+         return isNamingConventionSet() ? namingConvention
+                : getInheritedNamingConvention();
+    }
+
+    protected abstract int getInheritedNamingConvention();
+
+    /**
+     * Tells if this setting is set directly in this object or its value is inherited from
the parent parsing configuration..
+     */
+    @Override
+    public boolean isNamingConventionSet() {
+        return namingConvention != null;
+    }
+
+    /**
+     * See {@link Configuration#setWhitespaceStripping(boolean)}.
+     */
+    public void setWhitespaceStripping(boolean whitespaceStripping) {
+        this.whitespaceStripping = Boolean.valueOf(whitespaceStripping);
+    }
+
+    /**
+     * Fluent API equivalent of {@link #setWhitespaceStripping(boolean)}
+     */
+    public SelfT whitespaceStripping(boolean whitespaceStripping) {
+        setWhitespaceStripping(whitespaceStripping);
+        return self();
+    }
+
+    /**
+     * The getter pair of {@link #getWhitespaceStripping()}.
+     */
+    @Override
+    public boolean getWhitespaceStripping() {
+         return isWhitespaceStrippingSet() ? whitespaceStripping.booleanValue()
+                : getInheritedWhitespaceStripping();
+    }
+
+    protected abstract boolean getInheritedWhitespaceStripping();
+
+    /**
+     * Tells if this setting is set directly in this object or its value is inherited from
the parent parsing configuration..
+     */
+    @Override
+    public boolean isWhitespaceStrippingSet() {
+        return whitespaceStripping != null;
+    }
+
+    /**
+     * Sets the output format of the template; see {@link Configuration#setAutoEscapingPolicy(int)}
for more.
+     */
+    public void setAutoEscapingPolicy(int autoEscapingPolicy) {
+        Configuration.validateAutoEscapingPolicyValue(autoEscapingPolicy);
+
+        this.autoEscapingPolicy = Integer.valueOf(autoEscapingPolicy);
+    }
+
+    /**
+     * Fluent API equivalent of {@link #setAutoEscapingPolicy(int)}
+     */
+    public SelfT autoEscapingPolicy(int autoEscapingPolicy) {
+        setAutoEscapingPolicy(autoEscapingPolicy);
+        return self();
+    }
+
+    /**
+     * The getter pair of {@link #setAutoEscapingPolicy(int)}.
+     */
+    @Override
+    public int getAutoEscapingPolicy() {
+         return isAutoEscapingPolicySet() ? autoEscapingPolicy.intValue()
+                : getInheritedAutoEscapingPolicy();
+    }
+
+    protected abstract int getInheritedAutoEscapingPolicy();
+
+    /**
+     * Tells if this setting is set directly in this object or its value is inherited from
the parent parsing configuration..
+     */
+    @Override
+    public boolean isAutoEscapingPolicySet() {
+        return autoEscapingPolicy != null;
+    }
+
+    /**
+     * Sets the output format of the template; see {@link Configuration#setOutputFormat(OutputFormat)}
for more.
+     */
+    public void setOutputFormat(OutputFormat outputFormat) {
+        _NullArgumentException.check("outputFormat", outputFormat);
+        this.outputFormat = outputFormat;
+    }
+
+    /**
+     * Fluent API equivalent of {@link #setOutputFormat(OutputFormat)}
+     */
+    public SelfT outputFormat(OutputFormat outputFormat) {
+        setOutputFormat(outputFormat);
+        return self();
+    }
+
+    /**
+     * The getter pair of {@link #setOutputFormat(OutputFormat)}.
+     */
+    @Override
+    public OutputFormat getOutputFormat() {
+         return isOutputFormatSet() ? outputFormat : getInheritedOutputFormat();
+    }
+
+    protected abstract OutputFormat getInheritedOutputFormat();
+
+    /**
+     * Tells if this setting is set directly in this object or its value is inherited from
the parent parsing configuration..
+     */
+    @Override
+    public boolean isOutputFormatSet() {
+        return outputFormat != null;
+    }
+
+    /**
+     * See {@link Configuration#setRecognizeStandardFileExtensions(boolean)}.
+     */
+    public void setRecognizeStandardFileExtensions(boolean recognizeStandardFileExtensions)
{
+        this.recognizeStandardFileExtensions = Boolean.valueOf(recognizeStandardFileExtensions);
+    }
+
+    /**
+     * Fluent API equivalent of {@link #setRecognizeStandardFileExtensions(boolean)}
+     */
+    public SelfT recognizeStandardFileExtensions(boolean recognizeStandardFileExtensions)
{
+        setRecognizeStandardFileExtensions(recognizeStandardFileExtensions);
+        return self();
+    }
+
+    /**
+     * Getter pair of {@link #setRecognizeStandardFileExtensions(boolean)}.
+     */
+    @Override
+    public boolean getRecognizeStandardFileExtensions() {
+         return isRecognizeStandardFileExtensionsSet() ? recognizeStandardFileExtensions.booleanValue()
+                : getInheritedRecognizeStandardFileExtensions();
+    }
+
+    protected abstract boolean getInheritedRecognizeStandardFileExtensions();
+
+    /**
+     * Tells if this setting is set directly in this object or its value is inherited from
the parent parsing configuration..
+     */
+    @Override
+    public boolean isRecognizeStandardFileExtensionsSet() {
+        return recognizeStandardFileExtensions != null;
+    }
+
+    @Override
+    public Charset getSourceEncoding() {
+         return isSourceEncodingSet() ? sourceEncoding : getInheritedSourceEncoding();
+    }
+
+    protected abstract Charset getInheritedSourceEncoding();
+
+    /**
+     * The charset to be used when reading the template "file" that the {@link TemplateLoader}
returns as binary
+     * ({@link InputStream}). If the {@code #ftl} header specifies an charset, that will
override this.
+     */
+    public void setSourceEncoding(Charset sourceEncoding) {
+        _NullArgumentException.check("sourceEncoding", sourceEncoding);
+        this.sourceEncoding = sourceEncoding;
+    }
+
+    /**
+     * Fluent API equivalent of {@link #setSourceEncoding(Charset)}
+     */
+    public SelfT sourceEncoding(Charset sourceEncoding) {
+        setSourceEncoding(sourceEncoding);
+        return self();
+    }
+
+    public boolean isSourceEncodingSet() {
+        return sourceEncoding != null;
+    }
+
+    /**
+     * See {@link Configuration#setTabSize(int)}.
+     *
+     * @since 2.3.25
+     */
+    public void setTabSize(int tabSize) {
+        this.tabSize = Integer.valueOf(tabSize);
+    }
+
+    /**
+     * Fluent API equivalent of {@link #setTabSize(int)}
+     */
+    public SelfT tabSize(int tabSize) {
+        setTabSize(tabSize);
+        return self();
+    }
+
+    /**
+     * Getter pair of {@link #setTabSize(int)}.
+     *
+     * @since 2.3.25
+     */
+    @Override
+    public int getTabSize() {
+         return isTabSizeSet() ? tabSize.intValue() : getInheritedTabSize();
+    }
+
+    protected abstract int getInheritedTabSize();
+
+    /**
+     * Tells if this setting is set directly in this object or its value is inherited from
the parent parsing configuration..
+     *
+     * @since 2.3.25
+     */
+    @Override
+    public boolean isTabSizeSet() {
+        return tabSize != null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/18a4ace8/src/main/java/org/apache/freemarker/core/MutableProcessingAndParseConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/MutableProcessingAndParseConfiguration.java
b/src/main/java/org/apache/freemarker/core/MutableProcessingAndParseConfiguration.java
deleted file mode 100644
index 6b47360..0000000
--- a/src/main/java/org/apache/freemarker/core/MutableProcessingAndParseConfiguration.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.freemarker.core;
-
-import java.io.InputStream;
-import java.nio.charset.Charset;
-
-import org.apache.freemarker.core.outputformat.OutputFormat;
-import org.apache.freemarker.core.templateresolver.TemplateLoader;
-import org.apache.freemarker.core.util._NullArgumentException;
-
-// TODO This will be the superclass of TemplateConfiguration.Builder and Configuration.Builder
-public abstract class MutableProcessingAndParseConfiguration<
-        SelfT extends MutableProcessingAndParseConfiguration<SelfT>>
-        extends MutableProcessingConfiguration<SelfT>
-        implements ParserAndProcessingConfiguration {
-
-    private TemplateLanguage templateLanguage;
-    private Integer tagSyntax;
-    private Integer namingConvention;
-    private Boolean whitespaceStripping;
-    private Integer autoEscapingPolicy;
-    private Boolean recognizeStandardFileExtensions;
-    private OutputFormat outputFormat;
-    private Charset sourceEncoding;
-    private Integer tabSize;
-
-    protected MutableProcessingAndParseConfiguration(Version incompatibleImprovements) {
-        super(incompatibleImprovements);
-    }
-
-    protected MutableProcessingAndParseConfiguration() {
-        super();
-    }
-
-    /**
-     * See {@link Configuration#setTagSyntax(int)}.
-     */
-    public void setTagSyntax(int tagSyntax) {
-        Configuration.valideTagSyntaxValue(tagSyntax);
-        this.tagSyntax = tagSyntax;
-    }
-
-    /**
-     * Fluent API equivalent of {@link #tagSyntax(int)}
-     */
-    public SelfT tagSyntax(int tagSyntax) {
-        setTagSyntax(tagSyntax);
-        return self();
-    }
-
-    /**
-     * The getter pair of {@link #setTagSyntax(int)}.
-     */
-    @Override
-    public int getTagSyntax() {
-        return tagSyntax != null ? tagSyntax : getInheritedTagSyntax();
-    }
-
-    protected abstract int getInheritedTagSyntax();
-
-    @Override
-    public boolean isTagSyntaxSet() {
-        return tagSyntax != null;
-    }
-
-    /**
-     * See {@link Configuration#getTemplateLanguage()}
-     */
-    @Override
-    public TemplateLanguage getTemplateLanguage() {
-         return isTemplateLanguageSet() ? templateLanguage : getInheritedTemplateLanguage();
-    }
-
-    protected abstract TemplateLanguage getInheritedTemplateLanguage();
-
-    /**
-     * See {@link Configuration#setTemplateLanguage(TemplateLanguage)}
-     */
-    public void setTemplateLanguage(TemplateLanguage templateLanguage) {
-        _NullArgumentException.check("templateLanguage", templateLanguage);
-        this.templateLanguage = templateLanguage;
-    }
-
-    /**
-     * Fluent API equivalent of {@link #setTemplateLanguage(TemplateLanguage)}
-     */
-    public SelfT templateLanguage(TemplateLanguage templateLanguage) {
-        setTemplateLanguage(templateLanguage);
-        return self();
-    }
-
-    public boolean isTemplateLanguageSet() {
-        return templateLanguage != null;
-    }
-
-    /**
-     * See {@link Configuration#setNamingConvention(int)}.
-     */
-    public void setNamingConvention(int namingConvention) {
-        Configuration.validateNamingConventionValue(namingConvention);
-        this.namingConvention = namingConvention;
-    }
-
-    /**
-     * Fluent API equivalent of {@link #setNamingConvention(int)}
-     */
-    public SelfT namingConvention(int namingConvention) {
-        setNamingConvention(namingConvention);
-        return self();
-    }
-
-    /**
-     * The getter pair of {@link #setNamingConvention(int)}.
-     */
-    @Override
-    public int getNamingConvention() {
-         return isNamingConventionSet() ? namingConvention
-                : getInheritedNamingConvention();
-    }
-
-    protected abstract int getInheritedNamingConvention();
-
-    /**
-     * Tells if this setting is set directly in this object or its value is inherited from
the parent parsing configuration..
-     */
-    @Override
-    public boolean isNamingConventionSet() {
-        return namingConvention != null;
-    }
-
-    /**
-     * See {@link Configuration#setWhitespaceStripping(boolean)}.
-     */
-    public void setWhitespaceStripping(boolean whitespaceStripping) {
-        this.whitespaceStripping = Boolean.valueOf(whitespaceStripping);
-    }
-
-    /**
-     * Fluent API equivalent of {@link #setWhitespaceStripping(boolean)}
-     */
-    public SelfT whitespaceStripping(boolean whitespaceStripping) {
-        setWhitespaceStripping(whitespaceStripping);
-        return self();
-    }
-
-    /**
-     * The getter pair of {@link #getWhitespaceStripping()}.
-     */
-    @Override
-    public boolean getWhitespaceStripping() {
-         return isWhitespaceStrippingSet() ? whitespaceStripping.booleanValue()
-                : getInheritedWhitespaceStripping();
-    }
-
-    protected abstract boolean getInheritedWhitespaceStripping();
-
-    /**
-     * Tells if this setting is set directly in this object or its value is inherited from
the parent parsing configuration..
-     */
-    @Override
-    public boolean isWhitespaceStrippingSet() {
-        return whitespaceStripping != null;
-    }
-
-    /**
-     * Sets the output format of the template; see {@link Configuration#setAutoEscapingPolicy(int)}
for more.
-     */
-    public void setAutoEscapingPolicy(int autoEscapingPolicy) {
-        Configuration.validateAutoEscapingPolicyValue(autoEscapingPolicy);
-
-        this.autoEscapingPolicy = Integer.valueOf(autoEscapingPolicy);
-    }
-
-    /**
-     * Fluent API equivalent of {@link #setAutoEscapingPolicy(int)}
-     */
-    public SelfT autoEscapingPolicy(int autoEscapingPolicy) {
-        setAutoEscapingPolicy(autoEscapingPolicy);
-        return self();
-    }
-
-    /**
-     * The getter pair of {@link #setAutoEscapingPolicy(int)}.
-     */
-    @Override
-    public int getAutoEscapingPolicy() {
-         return isAutoEscapingPolicySet() ? autoEscapingPolicy.intValue()
-                : getInheritedAutoEscapingPolicy();
-    }
-
-    protected abstract int getInheritedAutoEscapingPolicy();
-
-    /**
-     * Tells if this setting is set directly in this object or its value is inherited from
the parent parsing configuration..
-     */
-    @Override
-    public boolean isAutoEscapingPolicySet() {
-        return autoEscapingPolicy != null;
-    }
-
-    /**
-     * Sets the output format of the template; see {@link Configuration#setOutputFormat(OutputFormat)}
for more.
-     */
-    public void setOutputFormat(OutputFormat outputFormat) {
-        _NullArgumentException.check("outputFormat", outputFormat);
-        this.outputFormat = outputFormat;
-    }
-
-    /**
-     * Fluent API equivalent of {@link #setOutputFormat(OutputFormat)}
-     */
-    public SelfT outputFormat(OutputFormat outputFormat) {
-        setOutputFormat(outputFormat);
-        return self();
-    }
-
-    /**
-     * The getter pair of {@link #setOutputFormat(OutputFormat)}.
-     */
-    @Override
-    public OutputFormat getOutputFormat() {
-         return isOutputFormatSet() ? outputFormat : getInheritedOutputFormat();
-    }
-
-    protected abstract OutputFormat getInheritedOutputFormat();
-
-    /**
-     * Tells if this setting is set directly in this object or its value is inherited from
the parent parsing configuration..
-     */
-    @Override
-    public boolean isOutputFormatSet() {
-        return outputFormat != null;
-    }
-
-    /**
-     * See {@link Configuration#setRecognizeStandardFileExtensions(boolean)}.
-     */
-    public void setRecognizeStandardFileExtensions(boolean recognizeStandardFileExtensions)
{
-        this.recognizeStandardFileExtensions = Boolean.valueOf(recognizeStandardFileExtensions);
-    }
-
-    /**
-     * Fluent API equivalent of {@link #setRecognizeStandardFileExtensions(boolean)}
-     */
-    public SelfT recognizeStandardFileExtensions(boolean recognizeStandardFileExtensions)
{
-        setRecognizeStandardFileExtensions(recognizeStandardFileExtensions);
-        return self();
-    }
-
-    /**
-     * Getter pair of {@link #setRecognizeStandardFileExtensions(boolean)}.
-     */
-    @Override
-    public boolean getRecognizeStandardFileExtensions() {
-         return isRecognizeStandardFileExtensionsSet() ? recognizeStandardFileExtensions.booleanValue()
-                : getInheritedRecognizeStandardFileExtensions();
-    }
-
-    protected abstract boolean getInheritedRecognizeStandardFileExtensions();
-
-    /**
-     * Tells if this setting is set directly in this object or its value is inherited from
the parent parsing configuration..
-     */
-    @Override
-    public boolean isRecognizeStandardFileExtensionsSet() {
-        return recognizeStandardFileExtensions != null;
-    }
-
-    @Override
-    public Charset getSourceEncoding() {
-         return isSourceEncodingSet() ? sourceEncoding : getInheritedSourceEncoding();
-    }
-
-    protected abstract Charset getInheritedSourceEncoding();
-
-    /**
-     * The charset to be used when reading the template "file" that the {@link TemplateLoader}
returns as binary
-     * ({@link InputStream}). If the {@code #ftl} header specifies an charset, that will
override this.
-     */
-    public void setSourceEncoding(Charset sourceEncoding) {
-        _NullArgumentException.check("sourceEncoding", sourceEncoding);
-        this.sourceEncoding = sourceEncoding;
-    }
-
-    /**
-     * Fluent API equivalent of {@link #setSourceEncoding(Charset)}
-     */
-    public SelfT sourceEncoding(Charset sourceEncoding) {
-        setSourceEncoding(sourceEncoding);
-        return self();
-    }
-
-    public boolean isSourceEncodingSet() {
-        return sourceEncoding != null;
-    }
-
-    /**
-     * See {@link Configuration#setTabSize(int)}.
-     *
-     * @since 2.3.25
-     */
-    public void setTabSize(int tabSize) {
-        this.tabSize = Integer.valueOf(tabSize);
-    }
-
-    /**
-     * Fluent API equivalent of {@link #setTabSize(int)}
-     */
-    public SelfT tabSize(int tabSize) {
-        setTabSize(tabSize);
-        return self();
-    }
-
-    /**
-     * Getter pair of {@link #setTabSize(int)}.
-     *
-     * @since 2.3.25
-     */
-    @Override
-    public int getTabSize() {
-         return isTabSizeSet() ? tabSize.intValue() : getInheritedTabSize();
-    }
-
-    protected abstract int getInheritedTabSize();
-
-    /**
-     * Tells if this setting is set directly in this object or its value is inherited from
the parent parsing configuration..
-     *
-     * @since 2.3.25
-     */
-    @Override
-    public boolean isTabSizeSet() {
-        return tabSize != null;
-    }
-
-}


Mime
View raw message