Interface ForEachStatus


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

    Modifier and Type
    Method
    Description
    Returns the index (starting from 0) that the iteration begins at, or null if not specified (and 0 is assumed).
    int
    Retrieves the "count" of the current round of the iteration.
    Returns the object of this iteration.
    Returns the index (starting from 0) that the iteration ends at, or null if not specified (and the last element is assumed).
    int
    Returns the index of the current round of the iteration.
    Returns the status of the enclosing forEach statement.
    Returns the value of the 'step' attribute for the associated tag, or null if no 'step' attribute was specified.
    boolean
    Returns whether the current round is the first pass through the iteration
    boolean
    Returns whether the current round is the last pass through the iteration
  • Method Details

    • getPrevious

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

      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

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

      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

      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