Class Foreach

java.lang.Object
org.apache.velocity.runtime.directive.Directive
org.apache.velocity.runtime.directive.Foreach
All Implemented Interfaces:
Cloneable, DirectiveConstants

public class Foreach extends Directive
Foreach directive used for moving through arrays, or objects that provide an Iterator.
Version:
$Id: Foreach.java 945927 2010-05-18 22:21:41Z nbubna $
  • Field Details

    • counterName

      private String counterName
      The name of the variable to use when placing the counter value into the context. Right now the default is $velocityCount.
    • hasNextName

      private String hasNextName
      The name of the variable to use when placing iterator hasNext() value into the context.Right now the defailt is $velocityHasNext
    • counterInitialValue

      private int counterInitialValue
      What value to start the loop counter at.
    • maxNbrLoops

      private int maxNbrLoops
      The maximum number of times we're allowed to loop.
    • skipInvalidIterator

      private boolean skipInvalidIterator
      Whether or not to throw an Exception if the iterator is null.
    • elementKey

      private String elementKey
      The reference name used to access each of the elements in the list object. It is the $item in the following: #foreach ($item in $list) This can be used class wide because it is immutable.
    • warned

      private boolean warned
    • uberInfo

      protected Info uberInfo
      immutable, so create in init
  • Constructor Details

    • Foreach

      public Foreach()
  • Method Details