freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject incubator-freemarker git commit: Added isXxxSetExplicity to DefaultObjectWrapper.ExtendableBuilder
Date Sat, 18 Mar 2017 15:21:14 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/3 c04f5b517 -> 077d4d53f


Added isXxxSetExplicity to DefaultObjectWrapper.ExtendableBuilder


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

Branch: refs/heads/3
Commit: 077d4d53fa946fcf09e530c87a51375d5ad7816f
Parents: c04f5b5
Author: ddekany <ddekany@apache.org>
Authored: Sat Mar 18 16:03:34 2017 +0100
Committer: ddekany <ddekany@apache.org>
Committed: Sat Mar 18 16:21:04 2017 +0100

----------------------------------------------------------------------
 .../core/model/impl/ClassIntrospector.java      | 22 ++++++-
 .../core/model/impl/DefaultObjectWrapper.java   | 60 ++++++++++++++++++++
 2 files changed, 80 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/077d4d53/src/main/java/org/apache/freemarker/core/model/impl/ClassIntrospector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/ClassIntrospector.java b/src/main/java/org/apache/freemarker/core/model/impl/ClassIntrospector.java
index 303672a..c7f9963 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/ClassIntrospector.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/ClassIntrospector.java
@@ -1080,8 +1080,11 @@ class ClassIntrospector {
 
         // Properties and their *defaults*:
         private int exposureLevel = DefaultObjectWrapper.EXPOSE_SAFE;
+        private boolean exposureLevelExplicitlySet;
         private boolean exposeFields;
+        private boolean exposeFieldsExplicitlySet;
         private MethodAppearanceFineTuner methodAppearanceFineTuner;
+        private boolean methodAppearanceFineTunerExplicitlySet;
         private MethodSorter methodSorter;
         // Attention:
         // - This is also used as a cache key, so non-normalized field values should be avoided.
@@ -1141,22 +1144,32 @@ class ClassIntrospector {
             return exposureLevel;
         }
 
-        /** See {@link DefaultObjectWrapper#setExposureLevel(int)}. */
+        /** See {@link DefaultObjectWrapper.ExtendableBuilder#setExposureLevel(int)}. */
         public void setExposureLevel(int exposureLevel) {
             if (exposureLevel < DefaultObjectWrapper.EXPOSE_ALL || exposureLevel >
DefaultObjectWrapper.EXPOSE_NOTHING) {
                 throw new IllegalArgumentException("Illegal exposure level: " + exposureLevel);
             }
 
             this.exposureLevel = exposureLevel;
+            exposureLevelExplicitlySet = true;
+        }
+
+        public boolean isExposureLevelExplicitlySet() {
+            return exposureLevelExplicitlySet;
         }
 
         public boolean getExposeFields() {
             return exposeFields;
         }
 
-        /** See {@link DefaultObjectWrapper#setExposeFields(boolean)}. */
+        /** See {@link DefaultObjectWrapper.ExtendableBuilder#setExposeFields(boolean)}.
*/
         public void setExposeFields(boolean exposeFields) {
             this.exposeFields = exposeFields;
+            exposeFieldsExplicitlySet = true;
+        }
+
+        public boolean isExposeFieldsExplicitlySet() {
+            return exposeFieldsExplicitlySet;
         }
 
         public MethodAppearanceFineTuner getMethodAppearanceFineTuner() {
@@ -1165,6 +1178,11 @@ class ClassIntrospector {
 
         public void setMethodAppearanceFineTuner(MethodAppearanceFineTuner methodAppearanceFineTuner)
{
             this.methodAppearanceFineTuner = methodAppearanceFineTuner;
+            methodAppearanceFineTunerExplicitlySet = true;
+        }
+
+        public boolean isMethodAppearanceFineTunerExplicitlySet() {
+            return methodAppearanceFineTunerExplicitlySet;
         }
 
         public MethodSorter getMethodSorter() {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/077d4d53/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java
b/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java
index 3e31739..73adecc 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapper.java
@@ -1339,10 +1339,15 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
 
         // Properties and their *defaults*:
         private int defaultDateType = TemplateDateModel.UNKNOWN;
+        private boolean defaultDataTypeExplicitlySet;
         private ObjectWrapper outerIdentity;
+        private boolean outerIdentityExplicitlySet;
         private boolean strict;
+        private boolean strictExplicitlySet;
         private boolean useModelCache;
+        private boolean useModelCacheExplicitlySet;
         private boolean usePrivateCaches;
+        private boolean usePrivateCachesExplicitlySet;
         // Attention!
         // - As this object is a cache key, non-normalized field values should be avoided.
         // - Fields with default values must be set until the end of the constructor to ensure
that when the lookup happens,
@@ -1489,6 +1494,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
          */
         public void setDefaultDateType(int defaultDateType) {
             this.defaultDateType = defaultDateType;
+            defaultDataTypeExplicitlySet = true;
         }
 
         /**
@@ -1500,6 +1506,13 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
         }
 
         /**
+         * Tells if the property was explicitly set, as opposed to just holding its default
value.
+         */
+        public boolean isDefaultDataTypeExplicitlySet() {
+            return defaultDataTypeExplicitlySet;
+        }
+
+        /**
          * Getter pair of {@link #setOuterIdentity(ObjectWrapper)}.
          */
         public ObjectWrapper getOuterIdentity() {
@@ -1517,6 +1530,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
          */
         public void setOuterIdentity(ObjectWrapper outerIdentity) {
             this.outerIdentity = outerIdentity;
+            outerIdentityExplicitlySet = true;
         }
 
         /**
@@ -1528,6 +1542,13 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
         }
 
         /**
+         * Tells if the property was explicitly set, as opposed to just holding its default
value.
+         */
+        public boolean isOuterIdentityExplicitlySet() {
+            return outerIdentityExplicitlySet;
+        }
+
+        /**
          * Getter pair of {@link #setStrict(boolean)}.
          */
         public boolean isStrict() {
@@ -1557,6 +1578,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
          */
         public void setStrict(boolean strict) {
             this.strict = strict;
+            strictExplicitlySet = true;
         }
 
         /**
@@ -1567,6 +1589,13 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
             return self();
         }
 
+        /**
+         * Tells if the property was explicitly set, as opposed to just holding its default
value.
+         */
+        public boolean isStrictExplicitlySet() {
+            return strictExplicitlySet;
+        }
+
         public boolean getUseModelCache() {
             return useModelCache;
         }
@@ -1577,6 +1606,7 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
         // [FM3] Remove
         public void setUseModelCache(boolean useModelCache) {
             this.useModelCache = useModelCache;
+            useModelCacheExplicitlySet = true;
         }
 
         /**
@@ -1589,6 +1619,13 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
         }
 
         /**
+         * Tells if the property was explicitly set, as opposed to just holding its default
value.
+         */
+        public boolean isUseModelCacheExplicitlySet() {
+            return useModelCacheExplicitlySet;
+        }
+
+        /**
          * Getter pair of {@link #setUsePrivateCaches(boolean)}.
          */
         public boolean getUsePrivateCaches() {
@@ -1601,6 +1638,14 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
          * */
         public void setUsePrivateCaches(boolean usePrivateCaches) {
             this.usePrivateCaches = usePrivateCaches;
+            usePrivateCaches = true;
+        }
+
+        /**
+         * Tells if the property was explicitly set, as opposed to just holding its default
value.
+         */
+        public boolean isUsePrivateCachesExplicitlySet() {
+            return usePrivateCachesExplicitlySet;
         }
 
         /**
@@ -1630,6 +1675,13 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
         }
 
         /**
+         * Tells if the property was explicitly set, as opposed to just holding its default
value.
+         */
+        public boolean setExposureLevelExplicitlySet() {
+            return classIntrospectorBuilder.isExposureLevelExplicitlySet();
+        }
+
+        /**
          * Getter pair of {@link #setExposeFields(boolean)}
          */
         public boolean getExposeFields() {
@@ -1658,6 +1710,10 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
             return self();
         }
 
+        public boolean isExposeFieldsExplicitlySet() {
+            return classIntrospectorBuilder.isExposeFieldsExplicitlySet();
+        }
+
         /**
          * Getter pair of {@link #setMethodAppearanceFineTuner(MethodAppearanceFineTuner)}
          */
@@ -1683,6 +1739,10 @@ public class DefaultObjectWrapper implements RichObjectWrapper {
             return self();
         }
 
+        public boolean isMethodAppearanceFineTunerExplicitlySet() {
+            return classIntrospectorBuilder.isMethodAppearanceFineTunerExplicitlySet();
+        }
+
         /**
          * Used internally for testing.
          */


Mime
View raw message