Interface ForEachStatus

  • All Known Implementing Classes:
    AbstractForEachStatus

    public interface ForEachStatus
    Represents the runtime information of each iteration caused by ForEach.

    The main use is to get the object in the outer iteration: forEachStatus.previous.each

    Since 8.0.0, we enhance this class to be consistent with JSTL's varStatus properties.

    Author:
    tomyeh
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.Integer getBegin()
      Returns the index (starting from 0) that the iteration begins at, or null if not specified (and 0 is assumed).
      int getCount()
      Retrieves the "count" of the current round of the iteration.
      java.lang.Object getCurrent()
      Returns the object of this iteration.
      java.lang.Object getEach()
      Deprecated.
      As of release 8.0.0, use getCurrent() instead.
      java.lang.Integer getEnd()
      Returns the index (starting from 0) that the iteration ends at, or null if not specified (and the last element is assumed).
      int getIndex()
      Returns the index of the current round of the iteration.
      ForEachStatus getPrevious()
      Returns the status of the enclosing forEach statement.
      java.lang.Integer getStep()
      Returns the value of the 'step' attribute for the associated tag, or null if no 'step' attribute was specified.
      boolean isFirst()
      Returns whether the current round is the first pass through the iteration
      boolean isLast()
      Returns whether the current round is the last pass through the iteration
    • Method Detail

      • getPrevious

        ForEachStatus getPrevious()
        Returns the status of the enclosing forEach statement.
      • getEach

        java.lang.Object getEach()
        Deprecated.
        As of release 8.0.0, use getCurrent() instead.
        Returns the object of this iteration.
      • getCurrent

        java.lang.Object getCurrent()
        Returns the object of this iteration.
        Since:
        8.0.0
      • getIndex

        int getIndex()
        Returns the index of the current round of the iteration. If iteration is being performed over a subset of an underlying array, collection, or other type, the index returned is absolute with respect to the underlying collection. Indices are 0-based.

        For example, if the iteration starts at the fifth element (forEachBegin is 4), then the first value returned by this method will be 4.

      • getBegin

        java.lang.Integer getBegin()
        Returns the index (starting from 0) that the iteration begins at, or null if not specified (and 0 is assumed).
      • getEnd

        java.lang.Integer getEnd()
        Returns the index (starting from 0) that the iteration ends at, or null if not specified (and the last element is assumed).
      • isFirst

        boolean isFirst()
        Returns whether the current round is the first pass through the iteration
        Since:
        8.0.0
      • isLast

        boolean isLast()
        Returns whether the current round is the last pass through the iteration
        Since:
        8.0.0
      • getStep

        java.lang.Integer getStep()
        Returns the value of the 'step' attribute for the associated tag, or null if no 'step' attribute was specified.
        Since:
        8.0.0
      • getCount

        int getCount()
        Retrieves the "count" of the current round of the iteration. The count is a relative, 1-based sequence number identifying the current "round" of iteration (in context with all rounds the current iteration will perform). As an example, an iteration with begin = 5, end = 15, and step = 5 produces the counts 1, 2, and 3 in that order.
        Since:
        8.0.0