velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From by...@apache.org
Subject svn commit: r745379 - /velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/contrib/For.java
Date Wed, 18 Feb 2009 04:47:56 GMT
Author: byron
Date: Wed Feb 18 04:47:55 2009
New Revision: 745379

URL: http://svn.apache.org/viewvc?rev=745379&view=rev
Log:
VELOCITY-696 Improve code documenation

Modified:
    velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/contrib/For.java

Modified: velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/contrib/For.java
URL: http://svn.apache.org/viewvc/velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/contrib/For.java?rev=745379&r1=745378&r2=745379&view=diff
==============================================================================
--- velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/contrib/For.java
(original)
+++ velocity/engine/branches/2.0_Exp/src/java/org/apache/velocity/runtime/directive/contrib/For.java
Wed Feb 18 04:47:55 2009
@@ -13,6 +13,15 @@
 import org.apache.velocity.runtime.parser.node.ASTReference;
 import org.apache.velocity.runtime.parser.node.Node;
 
+
+/**
+ * The #for directive provides the behavior of the #foreach directive but also
+ * provides an 'index' keyword that allows the user to define an optional index variable
+ * that tracks the loop iterations. e.g.; #for($user in $users index $i).
+ * As $user iterates through $users the index reference $i will be equal to
+ * 0, 1, 2, etc..
+ * @see org.apache.velocity.runtime.directive.Foreach 
+ */
 public class For extends Foreach
 {
 
@@ -60,7 +69,8 @@
             "Expected word 'index' at argument position 4 in #foreach",
             templateName, t);
       } 
-      else if (argtypes.size() == 4 || argtypes.get(4) != ParserTreeConstants.JJTREFERENCE)
+      else if (argtypes.size() == 4 
+          || argtypes.get(4) != ParserTreeConstants.JJTREFERENCE)
       {
         throw new MacroParseException(
             "Expected a reference after 'index' in #foreach", templateName, t);



Mime
View raw message