You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2017/04/14 22:09:59 UTC
incubator-freemarker git commit: Removed hasCustomFormats() from
configuration related API-s (we don't need it anymore)
Repository: incubator-freemarker
Updated Branches:
refs/heads/3 18a4ace82 -> ee44af74e
Removed hasCustomFormats() from configuration related API-s (we don't need it anymore)
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/ee44af74
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/ee44af74
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/ee44af74
Branch: refs/heads/3
Commit: ee44af74e396d6503811b4d516bf5d3c77848d0c
Parents: 18a4ace
Author: ddekany <dd...@apache.org>
Authored: Sat Apr 15 00:09:53 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sat Apr 15 00:09:53 2017 +0200
----------------------------------------------------------------------
.../apache/freemarker/core/Configuration.java | 5 -
.../org/apache/freemarker/core/Environment.java | 5 -
.../core/MutableProcessingConfiguration.java | 9 --
.../core/ProcessingConfiguration.java | 7 --
.../org/apache/freemarker/core/Template.java | 8 --
.../freemarker/core/TemplateConfiguration.java | 11 --
src/manual/en_US/FM3-CHANGE-LOG.txt | 3 +-
.../freemarker/core/ConfigurationTest.java | 119 -------------------
8 files changed, 2 insertions(+), 165 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ee44af74/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 1a0dfa6..f4f0242 100644
--- a/src/main/java/org/apache/freemarker/core/Configuration.java
+++ b/src/main/java/org/apache/freemarker/core/Configuration.java
@@ -1141,11 +1141,6 @@ public final class Configuration extends MutableProcessingConfiguration<Configur
}
@Override
- protected boolean getInheritedHasCustomFormats() {
- return false;
- }
-
- @Override
protected String getInheritedBooleanFormat() {
throw new BugException("Missing property value");
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ee44af74/src/main/java/org/apache/freemarker/core/Environment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/Environment.java b/src/main/java/org/apache/freemarker/core/Environment.java
index 1f75e2f..3834f99 100644
--- a/src/main/java/org/apache/freemarker/core/Environment.java
+++ b/src/main/java/org/apache/freemarker/core/Environment.java
@@ -1235,11 +1235,6 @@ public final class Environment extends MutableProcessingConfiguration<Environmen
}
@Override
- protected boolean getInheritedHasCustomFormats() {
- return getMainTemplate().hasCustomFormats();
- }
-
- @Override
protected String getInheritedBooleanFormat() {
return getMainTemplate().getBooleanFormat();
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ee44af74/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java b/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java
index 245114f..bc037e5 100644
--- a/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java
+++ b/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java
@@ -594,15 +594,6 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
protected abstract TemplateNumberFormatFactory getInheritedCustomNumberFormat(String name);
- @Override
- public boolean hasCustomFormats() {
- return isCustomNumberFormatsSet() && !customNumberFormats.isEmpty()
- || isCustomDateFormatsSet() && !customDateFormats.isEmpty()
- || getInheritedHasCustomFormats();
- }
-
- protected abstract boolean getInheritedHasCustomFormats();
-
/**
* Setter pair of {@link #getBooleanFormat()}.
*/
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ee44af74/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java b/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java
index 9dd8dc9..e90ceb3 100644
--- a/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java
+++ b/src/main/java/org/apache/freemarker/core/ProcessingConfiguration.java
@@ -211,13 +211,6 @@ public interface ProcessingConfiguration {
boolean isCustomNumberFormatsSet();
/**
- * Tells if {@link #getCustomNumberFormat(String)} or {@link #getCustomDateFormat(String)} (or any other future
- * method that returns custom formats) will return a custom format for some name. (Knowing that it's not the case
- * allows certain optimizations.)
- */
- boolean hasCustomFormats();
-
- /**
* The string value for the boolean {@code true} and {@code false} values, intended for human audience (not for a
* computer language), separated with comma. For example, {@code "yes,no"}. Note that white-space is significant,
* so {@code "yes, no"} is WRONG (unless you want that leading space before "no").
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ee44af74/src/main/java/org/apache/freemarker/core/Template.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/Template.java b/src/main/java/org/apache/freemarker/core/Template.java
index 726cd52..6359d67 100644
--- a/src/main/java/org/apache/freemarker/core/Template.java
+++ b/src/main/java/org/apache/freemarker/core/Template.java
@@ -841,14 +841,6 @@ public class Template implements ProcessingConfiguration, CustomStateScope {
}
@Override
- public boolean hasCustomFormats() {
- if (tCfg != null && tCfg.hasCustomFormats()) {
- return true;
- }
- return cfg.hasCustomFormats();
- }
-
- @Override
public String getBooleanFormat() {
return tCfg != null && tCfg.isBooleanFormatSet() ? tCfg.getBooleanFormat() : cfg.getBooleanFormat();
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ee44af74/src/main/java/org/apache/freemarker/core/TemplateConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/TemplateConfiguration.java b/src/main/java/org/apache/freemarker/core/TemplateConfiguration.java
index efb8152..5f62202 100644
--- a/src/main/java/org/apache/freemarker/core/TemplateConfiguration.java
+++ b/src/main/java/org/apache/freemarker/core/TemplateConfiguration.java
@@ -394,12 +394,6 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
}
@Override
- public boolean hasCustomFormats() {
- return isCustomNumberFormatsSet() && !customNumberFormats.isEmpty()
- || isCustomDateFormatsSet() && !customDateFormats.isEmpty();
- }
-
- @Override
public String getBooleanFormat() {
if (!isBooleanFormatSet()) {
throw new SettingValueNotSetException("booleanFormat");
@@ -712,11 +706,6 @@ public final class TemplateConfiguration implements ParsingAndProcessingConfigur
}
@Override
- protected boolean getInheritedHasCustomFormats() {
- return false;
- }
-
- @Override
protected String getInheritedBooleanFormat() {
throw new SettingValueNotSetException("booleanFormat");
}
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ee44af74/src/manual/en_US/FM3-CHANGE-LOG.txt
----------------------------------------------------------------------
diff --git a/src/manual/en_US/FM3-CHANGE-LOG.txt b/src/manual/en_US/FM3-CHANGE-LOG.txt
index e74a951..6964df3 100644
--- a/src/manual/en_US/FM3-CHANGE-LOG.txt
+++ b/src/manual/en_US/FM3-CHANGE-LOG.txt
@@ -204,4 +204,5 @@ the FreeMarer 3 changelog here:
other "actual" properties. (Just as in FM2, Template.getParserConfiguration() still can be used get the
sourceEncoding used during parsing.)
- Made TemplateModel classes used by the parser for literals Serializable. (Without this attribute values set in the #ftl
- header wouldn't be always Serializable, which in turn will sabotage making Template-s Serializable in the future.)
\ No newline at end of file
+ header wouldn't be always Serializable, which in turn will sabotage making Template-s Serializable in the future.)
+- Removed hasCustomFormats() from configuration related API-s (we don't need it anymore)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ee44af74/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/ConfigurationTest.java b/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
index b5c382f..b04e792 100644
--- a/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
+++ b/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
@@ -1206,126 +1206,7 @@ public class ConfigurationTest extends TestCase {
containsString(TemplateDateFormatFactory.class.getName())));
}
}
-
- @Test
- public void testHasCustomFormats() throws IOException, TemplateException {
- {
- Configuration cfg = new Configuration(Configuration.VERSION_3_0_0);
- Template t = new Template(null, "", cfg, null);
- Environment env = t.createProcessingEnvironment(null, null);
-
- assertFalse(cfg.hasCustomFormats());
- assertFalse(t.hasCustomFormats());
- assertFalse(env.hasCustomFormats());
- }
-
- {
- Configuration cfg = new Configuration(Configuration.VERSION_3_0_0);
- TemplateConfiguration.Builder tcb = new TemplateConfiguration.Builder();
- Template t = new Template(null, "", cfg, tcb.build());
- Environment env = t.createProcessingEnvironment(null, null);
-
- assertFalse(cfg.hasCustomFormats());
- assertFalse(t.hasCustomFormats());
- assertFalse(env.hasCustomFormats());
- }
-
- {
- Configuration cfg = new Configuration(Configuration.VERSION_3_0_0);
- TemplateConfiguration.Builder tcb = new TemplateConfiguration.Builder();
- Template t = new Template(null, "", cfg, tcb.build());
- Environment env = t.createProcessingEnvironment(null, null);
- env.setCustomDateFormats(Collections.singletonMap("f", EpochMillisTemplateDateFormatFactory.INSTANCE));
-
- assertFalse(cfg.hasCustomFormats());
- assertFalse(t.hasCustomFormats());
- assertTrue(env.hasCustomFormats());
- }
-
- {
- Configuration cfg = new Configuration(Configuration.VERSION_3_0_0);
- TemplateConfiguration.Builder tcb = new TemplateConfiguration.Builder();
- tcb.setCustomDateFormats(Collections.singletonMap("f", EpochMillisTemplateDateFormatFactory.INSTANCE));
- Template t = new Template(null, "", cfg, tcb.build());
- Environment env = t.createProcessingEnvironment(null, null);
-
- assertFalse(cfg.hasCustomFormats());
- assertTrue(t.hasCustomFormats());
- assertTrue(env.hasCustomFormats());
- }
-
- {
- Configuration cfg = new Configuration(Configuration.VERSION_3_0_0);
- cfg.setCustomDateFormats(Collections.singletonMap("f", EpochMillisTemplateDateFormatFactory.INSTANCE));
- TemplateConfiguration.Builder tcb = new TemplateConfiguration.Builder();
- Template t = new Template(null, "", cfg, tcb.build());
- Environment env = t.createProcessingEnvironment(null, null);
-
- assertTrue(cfg.hasCustomFormats());
- assertTrue(t.hasCustomFormats());
- assertTrue(env.hasCustomFormats());
- }
-
- // Same with number formats:
- {
- Configuration cfg = new Configuration(Configuration.VERSION_3_0_0);
- Template t = new Template(null, "", cfg, null);
- Environment env = t.createProcessingEnvironment(null, null);
-
- assertFalse(cfg.hasCustomFormats());
- assertFalse(t.hasCustomFormats());
- assertFalse(env.hasCustomFormats());
- }
-
- {
- Configuration cfg = new Configuration(Configuration.VERSION_3_0_0);
- TemplateConfiguration.Builder tcb = new TemplateConfiguration.Builder();
- Template t = new Template(null, "", cfg, tcb.build());
- Environment env = t.createProcessingEnvironment(null, null);
-
- assertFalse(cfg.hasCustomFormats());
- assertFalse(t.hasCustomFormats());
- assertFalse(env.hasCustomFormats());
- }
-
- {
- Configuration cfg = new Configuration(Configuration.VERSION_3_0_0);
- TemplateConfiguration.Builder tcb = new TemplateConfiguration.Builder();
- Template t = new Template(null, "", cfg, tcb.build());
- Environment env = t.createProcessingEnvironment(null, null);
- env.setCustomNumberFormats(Collections.singletonMap("f", HexTemplateNumberFormatFactory.INSTANCE));
-
- assertFalse(cfg.hasCustomFormats());
- assertFalse(t.hasCustomFormats());
- assertTrue(env.hasCustomFormats());
- }
-
- {
- Configuration cfg = new Configuration(Configuration.VERSION_3_0_0);
- TemplateConfiguration.Builder tcb = new TemplateConfiguration.Builder();
- tcb.setCustomNumberFormats(Collections.singletonMap("f", HexTemplateNumberFormatFactory.INSTANCE));
- Template t = new Template(null, "", cfg, tcb.build());
- Environment env = t.createProcessingEnvironment(null, null);
-
- assertFalse(cfg.hasCustomFormats());
- assertTrue(t.hasCustomFormats());
- assertTrue(env.hasCustomFormats());
- }
-
- {
- Configuration cfg = new Configuration(Configuration.VERSION_3_0_0);
- cfg.setCustomNumberFormats(Collections.singletonMap("f", HexTemplateNumberFormatFactory.INSTANCE));
- TemplateConfiguration.Builder tcb = new TemplateConfiguration.Builder();
- Template t = new Template(null, "", cfg, tcb.build());
- Environment env = t.createProcessingEnvironment(null, null);
-
- assertTrue(cfg.hasCustomFormats());
- assertTrue(t.hasCustomFormats());
- assertTrue(env.hasCustomFormats());
- }
- }
-
public void testNamingConventionSetSetting() throws ConfigurationException {
Configuration cfg = new Configuration(Configuration.VERSION_3_0_0);