Class Foreach

  • All Implemented Interfaces:
    java.lang.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 $
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected static class  Foreach.NullHolderContext
      A special context to use when the foreach iterator returns a null.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int counterInitialValue
      What value to start the loop counter at.
      private java.lang.String counterName
      The name of the variable to use when placing the counter value into the context.
      private java.lang.String elementKey
      The reference name used to access each of the elements in the list object.
      private java.lang.String hasNextName
      The name of the variable to use when placing iterator hasNext() value into the context.Right now the defailt is $velocityHasNext
      private int maxNbrLoops
      The maximum number of times we're allowed to loop.
      private boolean skipInvalidIterator
      Whether or not to throw an Exception if the iterator is null.
      protected Info uberInfo
      immutable, so create in init
      private boolean warned  
      • Fields inherited from class org.apache.velocity.runtime.directive.Directive

        rsvc
    • Constructor Summary

      Constructors 
      Constructor Description
      Foreach()  
    • Field Detail

      • counterName

        private java.lang.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 java.lang.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 java.lang.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 Detail

      • Foreach

        public Foreach()