freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [6/6] incubator-freemarker git commit: Various refactorings of Configurable and its subclasses. This is part of the preparation for making such classes immutable, and offer builders to create them.
Date Mon, 27 Mar 2017 11:48:55 GMT
Various refactorings of Configurable and its subclasses. This is part of the preparation for
making such classes immutable, and offer builders to create them.

- Removed CustomAttribute class. Custom attribute keys can be anything at the moment (this
will be certainly restricted later)
- As customAttributes won't be modifiable after Builder.build(), they can't be used for on-demand
created data structures anymore (such as Template-scoped caches) anymore. To fulfill that
role, the CustomStateKey class and the CustomStateScope interface was introduced, which is
somewhat similar to the now removed CustomAttribute. CustomStateScope contains one method,
Object getCustomState(CustomStateKey), which may calls CustomStateKey.create() to lazily create
the state object for the key. Configuration, Template and Environment implements CustomStateScope.
- Environment.setCustomState(Object, Object) and getCustomState(Object) was replaced with
CustomStateScope.getCustomState(CustomStateKey).
- Added getter/setter to access custom attributes as a Map. (This is to make it less an exceptional
setting.)
- Added ProcessingConfiguration interface for the read-only access of template processing
settings. This is similar to the already existing (in FM2) ParserConfiguration interface.
- Renamed Configurable to MutableProcessingAndParserConfiguration. Made it abstract too.
- Renamed Configuration.defaultEncoding to encoding, also added encoding ParserConfiguration.
Before this, defaultEncoding was exclusive to Configuration, but now it's like any other ParserConfiguration
setting.


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

Branch: refs/heads/3
Commit: 053afbf5d8f4e551ba416fb5a99327c60f08ef1d
Parents: 1870d02
Author: ddekany <ddekany@apache.org>
Authored: Mon Mar 27 13:48:36 2017 +0200
Committer: ddekany <ddekany@apache.org>
Committed: Mon Mar 27 13:48:36 2017 +0200

----------------------------------------------------------------------
 .../Java-code-style-FreeMarker.xml              |   31 +-
 .../apache/freemarker/core/ASTDirSetting.java   |   38 +-
 .../core/BuiltInsForMultipleTypes.java          |    2 +-
 .../apache/freemarker/core/Configurable.java    | 2741 -----------------
 .../apache/freemarker/core/Configuration.java   |  155 +-
 .../apache/freemarker/core/CustomAttribute.java |  264 --
 .../apache/freemarker/core/CustomStateKey.java  |   60 +
 .../freemarker/core/CustomStateScope.java       |   34 +
 .../org/apache/freemarker/core/Environment.java |   87 +-
 .../MutableProcessingAndParseConfiguration.java |  282 ++
 .../core/MutableProcessingConfiguration.java    | 2890 ++++++++++++++++++
 .../freemarker/core/ParserConfiguration.java    |   85 +-
 .../core/ProcessingConfiguration.java           |  335 ++
 .../core/SettingValueNotSetException.java       |   33 +
 .../org/apache/freemarker/core/Template.java    |   30 +-
 .../freemarker/core/TemplateClassResolver.java  |    2 +-
 .../freemarker/core/TemplateConfiguration.java  |   97 +-
 .../core/TemplateExceptionHandler.java          |    2 +-
 ..._ParserConfigurationWithInheritedFormat.java |   47 +-
 .../core/debug/DebuggedEnvironment.java         |    4 +-
 .../core/debug/RmiDebuggedEnvironmentImpl.java  |   43 +-
 .../freemarker/core/model/impl/BeanModel.java   |    2 +-
 .../core/model/impl/DefaultObjectWrapper.java   |    1 +
 .../core/model/impl/ResourceBundleModel.java    |    2 +-
 .../freemarker/core/model/impl/SimpleHash.java  |   10 +-
 .../core/model/impl/SimpleSequence.java         |    2 +-
 .../impl/DefaultTemplateResolver.java           |    6 +-
 .../core/util/OptInTemplateClassResolver.java   |    4 +-
 .../freemarker/core/util/_CollectionUtil.java   |    2 +-
 .../freemarker/core/util/_LocaleUtil.java       |    4 +-
 .../freemarker/core/util/_ObjectHolder.java     |   55 +
 .../valueformat/TemplateDateFormatFactory.java  |    6 +-
 .../TemplateNumberFormatFactory.java            |    6 +-
 .../impl/ISOLikeTemplateDateFormatFactory.java  |   31 +-
 .../freemarker/dom/JaxenXPathSupport.java       |   61 +-
 .../freemarker/servlet/FreemarkerServlet.java   |   34 +-
 src/manual/en_US/FM3-CHANGE-LOG.txt             |   17 +-
 .../freemarker/core/ConfigurableTest.java       |   18 +-
 .../freemarker/core/ConfigurationTest.java      |   58 +-
 .../freemarker/core/CustomAttributeTest.java    |   76 +-
 .../freemarker/core/EncodingOverrideTest.java   |    2 +-
 .../core/EnvironmentCustomStateTest.java        |   47 -
 .../IncludeAndImportConfigurableLayersTest.java |    2 +-
 .../core/ObjectBuilderSettingsTest.java         |   30 +-
 .../core/TemplateConfigurationTest.java         |  148 +-
 ...igurationWithDefaltTemplateResolverTest.java |   28 +-
 .../core/TemplateConstructorsTest.java          |    2 +-
 .../core/TemplateGetEncodingTest.java           |    2 +-
 .../DefaultTemplateResolverTest.java            |    4 +-
 .../manualtest/GettingStartedExample.java       |    2 +-
 .../TemplateConfigurationExamples.java          |    2 +-
 .../servlet/FreemarkerServletTest.java          |    4 +-
 .../apache/freemarker/test/TemplateTest.java    |    2 +-
 .../test/templatesuite/TemplateTestCase.java    |    2 +-
 .../servlet/jsp/webapps/basic/WEB-INF/web.xml   |    4 +-
 .../jsp/webapps/multipleLoaders/WEB-INF/web.xml |    2 +-
 .../jsp/webapps/tldDiscovery/WEB-INF/web.xml    |    4 +-
 .../org/apache/freemarker/test/servlet/web.xml  |    2 +-
 58 files changed, 4385 insertions(+), 3561 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/053afbf5/src/ide-settings/IntelliJ-IDEA/Java-code-style-FreeMarker.xml
----------------------------------------------------------------------
diff --git a/src/ide-settings/IntelliJ-IDEA/Java-code-style-FreeMarker.xml b/src/ide-settings/IntelliJ-IDEA/Java-code-style-FreeMarker.xml
index c4bbf97..d77ca2d 100644
--- a/src/ide-settings/IntelliJ-IDEA/Java-code-style-FreeMarker.xml
+++ b/src/ide-settings/IntelliJ-IDEA/Java-code-style-FreeMarker.xml
@@ -1,21 +1,3 @@
-<!--
-  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.
--->
 <code_scheme name="FreeMarker">
   <option name="LINE_SEPARATOR" value="&#xA;" />
   <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
@@ -45,9 +27,22 @@
   <option name="JD_PARAM_DESCRIPTION_ON_NEW_LINE" value="true" />
   <option name="WRAP_COMMENTS" value="true" />
   <JavaCodeStyleSettings>
+    <option name="ANNOTATION_PARAMETER_WRAP" value="1" />
     <option name="CLASS_NAMES_IN_JAVADOC" value="3" />
   </JavaCodeStyleSettings>
   <codeStyleSettings language="JAVA">
     <option name="RIGHT_MARGIN" value="120" />
+    <option name="CALL_PARAMETERS_WRAP" value="1" />
+    <option name="EXTENDS_LIST_WRAP" value="1" />
+    <option name="THROWS_LIST_WRAP" value="1" />
+    <option name="EXTENDS_KEYWORD_WRAP" value="1" />
+    <option name="BINARY_OPERATION_WRAP" value="1" />
+    <option name="TERNARY_OPERATION_WRAP" value="1" />
+    <option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
+    <option name="ARRAY_INITIALIZER_WRAP" value="1" />
+    <option name="ASSIGNMENT_WRAP" value="1" />
+    <option name="WRAP_LONG_LINES" value="true" />
+    <option name="PARAMETER_ANNOTATION_WRAP" value="1" />
+    <option name="VARIABLE_ANNOTATION_WRAP" value="1" />
   </codeStyleSettings>
 </code_scheme>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/053afbf5/src/main/java/org/apache/freemarker/core/ASTDirSetting.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ASTDirSetting.java b/src/main/java/org/apache/freemarker/core/ASTDirSetting.java
index 0e1c31d..396d269 100644
--- a/src/main/java/org/apache/freemarker/core/ASTDirSetting.java
+++ b/src/main/java/org/apache/freemarker/core/ASTDirSetting.java
@@ -37,25 +37,25 @@ final class ASTDirSetting extends ASTDirective {
     
     static final String[] SETTING_NAMES = new String[] {
             // Must be sorted alphabetically!
-            Configurable.BOOLEAN_FORMAT_KEY_CAMEL_CASE,
-            Configurable.BOOLEAN_FORMAT_KEY_SNAKE_CASE,
-            Configurable.DATE_FORMAT_KEY_CAMEL_CASE,
-            Configurable.DATE_FORMAT_KEY_SNAKE_CASE,
-            Configurable.DATETIME_FORMAT_KEY_CAMEL_CASE,
-            Configurable.DATETIME_FORMAT_KEY_SNAKE_CASE,
-            Configurable.LOCALE_KEY,
-            Configurable.NUMBER_FORMAT_KEY_CAMEL_CASE,
-            Configurable.NUMBER_FORMAT_KEY_SNAKE_CASE,
-            Configurable.OUTPUT_ENCODING_KEY_CAMEL_CASE,
-            Configurable.OUTPUT_ENCODING_KEY_SNAKE_CASE,
-            Configurable.SQL_DATE_AND_TIME_TIME_ZONE_KEY_CAMEL_CASE,
-            Configurable.SQL_DATE_AND_TIME_TIME_ZONE_KEY,
-            Configurable.TIME_FORMAT_KEY_CAMEL_CASE,
-            Configurable.TIME_ZONE_KEY_CAMEL_CASE,
-            Configurable.TIME_FORMAT_KEY_SNAKE_CASE,
-            Configurable.TIME_ZONE_KEY_SNAKE_CASE,
-            Configurable.URL_ESCAPING_CHARSET_KEY_CAMEL_CASE,
-            Configurable.URL_ESCAPING_CHARSET_KEY_SNAKE_CASE
+            MutableProcessingConfiguration.BOOLEAN_FORMAT_KEY_CAMEL_CASE,
+            MutableProcessingConfiguration.BOOLEAN_FORMAT_KEY_SNAKE_CASE,
+            MutableProcessingConfiguration.DATE_FORMAT_KEY_CAMEL_CASE,
+            MutableProcessingConfiguration.DATE_FORMAT_KEY_SNAKE_CASE,
+            MutableProcessingConfiguration.DATETIME_FORMAT_KEY_CAMEL_CASE,
+            MutableProcessingConfiguration.DATETIME_FORMAT_KEY_SNAKE_CASE,
+            MutableProcessingConfiguration.LOCALE_KEY,
+            MutableProcessingConfiguration.NUMBER_FORMAT_KEY_CAMEL_CASE,
+            MutableProcessingConfiguration.NUMBER_FORMAT_KEY_SNAKE_CASE,
+            MutableProcessingConfiguration.OUTPUT_ENCODING_KEY_CAMEL_CASE,
+            MutableProcessingConfiguration.OUTPUT_ENCODING_KEY_SNAKE_CASE,
+            MutableProcessingConfiguration.SQL_DATE_AND_TIME_TIME_ZONE_KEY_CAMEL_CASE,
+            MutableProcessingConfiguration.SQL_DATE_AND_TIME_TIME_ZONE_KEY,
+            MutableProcessingConfiguration.TIME_FORMAT_KEY_CAMEL_CASE,
+            MutableProcessingConfiguration.TIME_ZONE_KEY_CAMEL_CASE,
+            MutableProcessingConfiguration.TIME_FORMAT_KEY_SNAKE_CASE,
+            MutableProcessingConfiguration.TIME_ZONE_KEY_SNAKE_CASE,
+            MutableProcessingConfiguration.URL_ESCAPING_CHARSET_KEY_CAMEL_CASE,
+            MutableProcessingConfiguration.URL_ESCAPING_CHARSET_KEY_SNAKE_CASE
     };
 
     ASTDirSetting(Token keyTk, FMParserTokenManager tokenManager, ASTExpression value, Configuration
cfg)

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/053afbf5/src/main/java/org/apache/freemarker/core/BuiltInsForMultipleTypes.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/BuiltInsForMultipleTypes.java b/src/main/java/org/apache/freemarker/core/BuiltInsForMultipleTypes.java
index 64899e9..e75ea9e 100644
--- a/src/main/java/org/apache/freemarker/core/BuiltInsForMultipleTypes.java
+++ b/src/main/java/org/apache/freemarker/core/BuiltInsForMultipleTypes.java
@@ -231,7 +231,7 @@ class BuiltInsForMultipleTypes {
         TemplateModel _eval(Environment env) throws TemplateException {
             if (!env.isAPIBuiltinEnabled()) {
                 throw new _MiscTemplateException(this,
-                        "Can't use ?api, because the \"", Configurable.API_BUILTIN_ENABLED_KEY,
+                        "Can't use ?api, because the \"", MutableProcessingConfiguration.API_BUILTIN_ENABLED_KEY,
                         "\" configuration setting is false. Think twice before you set it
to true though. Especially, "
                         + "it shouldn't abussed for modifying Map-s and Collection-s.");
             }


Mime
View raw message