aboutsummaryrefslogtreecommitdiff
path: root/velocity-engine-core/src/main/resources/org/apache/velocity
diff options
context:
space:
mode:
authorClaude Brisson <cbrisson@apache.org>2017-02-20 10:58:58 +0000
committerClaude Brisson <cbrisson@apache.org>2017-02-20 10:58:58 +0000
commita970dc446c23cfec163226111b98e764df5eb128 (patch)
treed0438dd4176227d02c5056d03214722bb1069577 /velocity-engine-core/src/main/resources/org/apache/velocity
parent4dc2f90c75f9060f7e6d7add27d6eec650e0e182 (diff)
downloadapache-velocity-engine-a970dc446c23cfec163226111b98e764df5eb128.tar.gz
[engine] implements new strategy for reference boolean evaluation
1) return false for a null object 2) return its value for a Boolean object, or the result of the getAsBoolean() method if it exists. 3) If directive.if.emptycheck = false (true by default), stop here and return true. 4) check for emptiness: - return whether an array is empty. - return whether isEmpty() is false (covers String and all Collection classes). - return whether length() is zero (covers CharSequence classes other than String). - returns whether size() is zero. - return whether a Number *strictly* equals zero. 5) check for emptiness after explicit conversion methods: - return whether the result of getAsString() is empty (and false for a null result) if it exists. - return whether the result of getAsNumber() *strictly* equals zero (and false for a null result) if it exists. git-svn-id: https://svn.apache.org/repos/asf/velocity/engine/trunk@1783739 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'velocity-engine-core/src/main/resources/org/apache/velocity')
-rw-r--r--velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties9
1 files changed, 9 insertions, 0 deletions
diff --git a/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties b/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties
index 3f416a62..c1ff863a 100644
--- a/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties
+++ b/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties
@@ -44,6 +44,15 @@ runtime.string.interning = true
directive.foreach.maxloops = -1
# ----------------------------------------------------------------------------
+# I F P R O P E R T I E S
+# ----------------------------------------------------------------------------
+# This property controls whether empty strings and collections,
+# as long as zero numbers, do evaluate to false.
+# ----------------------------------------------------------------------------
+
+directive.if.emptycheck = true
+
+# ----------------------------------------------------------------------------
# I N C L U D E P R O P E R T I E S
# ----------------------------------------------------------------------------
# These are the properties that governed the way #include'd content