Author: cbrisson
Date: Fri Apr  5 14:50:22 2019
New Revision: 1857012

URL: http://svn.apache.org/viewvc?rev=1857012&view=rev
Log:
[site/engine] #if() empty checks clarification (prod)

Modified:
    velocity/site/production/engine/2.1/configuration.html
    velocity/site/production/engine/2.1/user-guide.html
    velocity/site/production/engine/devel/configuration.html
    velocity/site/production/engine/devel/user-guide.html

Modified: velocity/site/production/engine/2.1/configuration.html
URL: 
http://svn.apache.org/viewvc/velocity/site/production/engine/2.1/configuration.html?rev=1857012&r1=1857011&r2=1857012&view=diff
==============================================================================
--- velocity/site/production/engine/2.1/configuration.html (original)
+++ velocity/site/production/engine/2.1/configuration.html Fri Apr  5 14:50:22 
2019
@@ -362,17 +362,17 @@ h2:hover > .headerlink, h3:hover > .head
 <h3 id="if-directive">#if() Directive<a class="headerlink" 
href="#if-directive" title="Permanent link">&para;</a></h3>
 <p><strong><code>directive.if.empty_check = true</code></strong></p>
 <blockquote>
-<p>When evaluating if a reference resolves to <code>true</code> or 
<code>false</code> in a boolean context, the engine first checks if its value 
is null, if it is a Boolean or if it has a getAsBoolean() method. Then, if none 
of this applies, the behavior depends upon this configuration flag:</p>
+<p>When evaluating if a reference resolves to <code>true</code> or 
<code>false</code> in a boolean context, the engine first checks if its value 
is <code>null</code>, if it is a <code>Boolean</code> or if it has a public 
<code>getAsBoolean()</code> method. Then, if none of this applies, the behavior 
depends upon this configuration flag:</p>
 <ul>
 <li>if <code>directive.if.empty_check</code> is <code>false</code>, no further 
check is performed and the object resolves to <code>true</code>.</li>
 <li>if <code>directive.if.empty_check</code> is <code>true</code>, the object 
is check for emptiness and zero value:<ul>
 <li>return whether an array is empty.</li>
-<li>return whether isEmpty() is false (covers String and all Collection 
classes).</li>
-<li>return whether length() is zero (covers CharSequence classes other than 
String).</li>
-<li>returns whether size() is zero (covers all Collections classes).</li>
-<li>return whether a Number <em>strictly</em> equals zero.</li>
-<li>return whether the result of getAsString() is empty (and false for a null 
result) if it exists.</li>
-<li>return whether the result of getAsNumber() <em>strictly</em> equals zero 
(and false for a null result) if it exists.</li>
+<li>return whether a public <code>isEmpty()</code> method exists and evaluates 
to false (<code>String</code>, <code>Collection</code>, etc).</li>
+<li>return whether a public <code>length()</code> method exists and evaluates 
to zero (<code>CharSequence</code>, etc).</li>
+<li>return whether a public <code>size()</code> method exists and evaluates to 
zero.</li>
+<li>return whether a <code>Number</code> <em>strictly</em> equals zero.</li>
+<li>return whether a public <code>getAsString()</code> method exists and 
evaluates to null or an empty string.</li>
+<li>return whether a public <code>getAsNumber()</code> method exists and 
evaluates to null or <em>strictly</em> zero.</li>
 </ul>
 </li>
 </ul>

Modified: velocity/site/production/engine/2.1/user-guide.html
URL: 
http://svn.apache.org/viewvc/velocity/site/production/engine/2.1/user-guide.html?rev=1857012&r1=1857011&r2=1857012&view=diff
==============================================================================
--- velocity/site/production/engine/2.1/user-guide.html (original)
+++ velocity/site/production/engine/2.1/user-guide.html Fri Apr  5 14:50:22 2019
@@ -734,9 +734,9 @@ $foo
 <li><em>$foo</em> is a boolean (true/false) which has a true value</li>
 <li><em>$foo</em> is a string or a collection which is not null 
<strong>and</strong> not empty</li>
 <li><em>$foo</em> is a number which is not equal to zero</li>
-<li><em>$foo</em> is an object (other than a string, a number or a collection) 
which is not null</li>
+<li><em>$foo</em> is an object (other than a string, a number or a collection) 
which is not null (and for which the standard public methods for querying the 
object size, length or boolean/string representations, if they exist, indicate 
a non-empty, non-zero, non-false object).</li>
 </ul>
-<p>(please note that this is the default behavior, but Velocity can be 
configured to <a href="configuration.html#if-directive">skip all checks beyond 
boolean and nullity ones</a>).</p>
+<p>Please check the <a href="configuration.html#if-directive">#if directive 
configuration section</a> for implementation details. This section also 
explains how to change this default behavior so that Velocity skips all checks 
beyond boolean and nullity ones.</p>
 <p>To test if a reference has a special values, you can use:</p>
 <ul>
 <li><code>#if ($ref == $null)</code> to specifically test for the null value 
(provided you didn't put anything in <code>$null</code>)</li>
@@ -1390,11 +1390,11 @@ $!{foo}
 
 
 <p>which defaults to false.  When set to true <em>along with</em></p>
-<div class="codehilite"><pre>`resource.loader.&lt;name&gt;.cache = false`
+<div class="codehilite"><pre>`resource.loader.&lt;type&gt;.cache = false`
 </pre></div>
 
 
-<p>(where <name> is the name of the resource loader that you are using, such 
as 'file') then the Velocity engine will automatically reload changes to your 
Velocimacro library files when you make them, so you do not have to dump the 
servlet engine (or application) or do other tricks to have your Velocimacros 
reloaded.</p>
+<p>(where <type> is the name of the resource loader that you are using, such 
as 'file') then the Velocity engine will automatically reload changes to your 
Velocimacro library files when you make them, so you do not have to dump the 
servlet engine (or application) or do other tricks to have your Velocimacros 
reloaded.</p>
 <p>Here is what a simple set of configuration properties would look like.</p>
 <div class="codehilite"><pre>resource.loader.file.path = templates
 resource.loader.file.cache = false

Modified: velocity/site/production/engine/devel/configuration.html
URL: 
http://svn.apache.org/viewvc/velocity/site/production/engine/devel/configuration.html?rev=1857012&r1=1857011&r2=1857012&view=diff
==============================================================================
--- velocity/site/production/engine/devel/configuration.html (original)
+++ velocity/site/production/engine/devel/configuration.html Fri Apr  5 
14:50:22 2019
@@ -362,17 +362,17 @@ h2:hover > .headerlink, h3:hover > .head
 <h3 id="if-directive">#if() Directive<a class="headerlink" 
href="#if-directive" title="Permanent link">&para;</a></h3>
 <p><strong><code>directive.if.empty_check = true</code></strong></p>
 <blockquote>
-<p>When evaluating if a reference resolves to <code>true</code> or 
<code>false</code> in a boolean context, the engine first checks if its value 
is null, if it is a Boolean or if it has a getAsBoolean() method. Then, if none 
of this applies, the behavior depends upon this configuration flag:</p>
+<p>When evaluating if a reference resolves to <code>true</code> or 
<code>false</code> in a boolean context, the engine first checks if its value 
is <code>null</code>, if it is a <code>Boolean</code> or if it has a public 
<code>getAsBoolean()</code> method. Then, if none of this applies, the behavior 
depends upon this configuration flag:</p>
 <ul>
 <li>if <code>directive.if.empty_check</code> is <code>false</code>, no further 
check is performed and the object resolves to <code>true</code>.</li>
 <li>if <code>directive.if.empty_check</code> is <code>true</code>, the object 
is check for emptiness and zero value:<ul>
 <li>return whether an array is empty.</li>
-<li>return whether isEmpty() is false (covers String and all Collection 
classes).</li>
-<li>return whether length() is zero (covers CharSequence classes other than 
String).</li>
-<li>returns whether size() is zero (covers all Collections classes).</li>
-<li>return whether a Number <em>strictly</em> equals zero.</li>
-<li>return whether the result of getAsString() is empty (and false for a null 
result) if it exists.</li>
-<li>return whether the result of getAsNumber() <em>strictly</em> equals zero 
(and false for a null result) if it exists.</li>
+<li>return whether a public <code>isEmpty()</code> method exists and evaluates 
to false (<code>String</code>, <code>Collection</code>, etc).</li>
+<li>return whether a public <code>length()</code> method exists and evaluates 
to zero (<code>CharSequence</code>, etc).</li>
+<li>return whether a public <code>size()</code> method exists and evaluates to 
zero.</li>
+<li>return whether a <code>Number</code> <em>strictly</em> equals zero.</li>
+<li>return whether a public <code>getAsString()</code> method exists and 
evaluates to null or an empty string.</li>
+<li>return whether a public <code>getAsNumber()</code> method exists and 
evaluates to null or <em>strictly</em> zero.</li>
 </ul>
 </li>
 </ul>

Modified: velocity/site/production/engine/devel/user-guide.html
URL: 
http://svn.apache.org/viewvc/velocity/site/production/engine/devel/user-guide.html?rev=1857012&r1=1857011&r2=1857012&view=diff
==============================================================================
--- velocity/site/production/engine/devel/user-guide.html (original)
+++ velocity/site/production/engine/devel/user-guide.html Fri Apr  5 14:50:22 
2019
@@ -734,9 +734,9 @@ $foo
 <li><em>$foo</em> is a boolean (true/false) which has a true value</li>
 <li><em>$foo</em> is a string or a collection which is not null 
<strong>and</strong> not empty</li>
 <li><em>$foo</em> is a number which is not equal to zero</li>
-<li><em>$foo</em> is an object (other than a string, a number or a collection) 
which is not null</li>
+<li><em>$foo</em> is an object (other than a string, a number or a collection) 
which is not null (and for which the standard public methods for querying the 
object size, length or boolean/string representations, if they exist, indicate 
a non-empty, non-zero, non-false object).</li>
 </ul>
-<p>(please note that this is the default behavior, but Velocity can be 
configured to <a href="configuration.html#if-directive">skip all checks beyond 
boolean and nullity ones</a>).</p>
+<p>Please check the <a href="configuration.html#if-directive">#if directive 
configuration section</a> for implementation details. This section also 
explains how to change this default behavior so that Velocity skips all checks 
beyond boolean and nullity ones.</p>
 <p>To test if a reference has a special values, you can use:</p>
 <ul>
 <li><code>#if ($ref == $null)</code> to specifically test for the null value 
(provided you didn't put anything in <code>$null</code>)</li>


Reply via email to