javax.servlet.jsp.jstl.core
Interface LoopTagStatus


public interface LoopTagStatus

Exposes the current status of an iteration. JSTL provides a mechanism for LoopTags to return information about the current index of the iteration and convenience methods to determine whether or not the current round is either the first or last in the iteration. It also lets authors use the status object to obtain information about the iteration range, step, and current object.

Environments that require more status can extend this interface.

Author:
Shawn Bayern

Method Summary
 java.lang.Integer getBegin()
          Returns the value of the 'begin' attribute for the associated tag, or null if no 'begin' attribute was specified.
 int getCount()
          Retrieves the "count" of the current round of the iteration.
 java.lang.Object getCurrent()
          Retrieves the current item in the iteration.
 java.lang.Integer getEnd()
          Returns the value of the 'end' attribute for the associated tag, or null if no 'end' attribute was specified.
 int getIndex()
          Retrieves the index of the current round of the iteration.
 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 information about whether the current round of the iteration is the first one.
 boolean isLast()
          Returns information about whether the current round of the iteration is the last one.
 

Method Detail

getCurrent

java.lang.Object getCurrent()
Retrieves the current item in the iteration. Behaves idempotently; calling getCurrent() repeatedly should return the same Object until the iteration is advanced. (Specifically, calling getCurrent() does not advance the iteration.)

Returns:
the current item as an object

getIndex

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

Returns:
the 0-based index of the current round of the iteration

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.

Returns:
the 1-based count of the current round of the iteration

isFirst

boolean isFirst()
Returns information about whether the current round of the iteration is the first one. This current round may be the 'first' even when getIndex() != 0, for 'index' refers to the absolute index of the current 'item' in the context of its underlying collection. It is always that case that a true result from isFirst() implies getCount() == 1.

Returns:
true if the current round is the first in the iteration, false otherwise.

isLast

boolean isLast()
Returns information about whether the current round of the iteration is the last one. As with isFirst(), subsetting is taken into account. isLast() doesn't necessarily refer to the status of the underlying Iterator; it refers to whether or not the current round will be the final round of iteration for the tag associated with this LoopTagStatus.

Returns:
true if the current round is the last in the iteration, false otherwise.

getBegin

java.lang.Integer getBegin()
Returns the value of the 'begin' attribute for the associated tag, or null if no 'begin' attribute was specified.

Returns:
the 'begin' value for the associated tag, or null if no 'begin' attribute was specified

getEnd

java.lang.Integer getEnd()
Returns the value of the 'end' attribute for the associated tag, or null if no 'end' attribute was specified.

Returns:
the 'end' value for the associated tag, or null if no 'end' attribute was specified

getStep

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

Returns:
the 'step' value for the associated tag, or null if no 'step' attribute was specified


Submit a bug or feature

Copyright © 2009-2011, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.

Generated on 10-February-2011 12:41


Spec-Zone.ru - all specs in one place



free hit counter