KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > servlet > jsp > jstl > core > LoopTagStatus


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package javax.servlet.jsp.jstl.core;
18
19 /**
20  * <p>Exposes the current status of
21  * an iteration. JSTL provides a mechanism for LoopTags to
22  * return information about the current index of the iteration and
23  * convenience methods to determine whether or not the current round is
24  * either the first or last in the iteration. It also lets authors
25  * use the status object to obtain information about the iteration range,
26  * step, and current object.</p>
27  *
28  * <p>Environments that require more status can extend this interface.</p>
29  *
30  * @author Shawn Bayern
31  */

32
33 public interface LoopTagStatus {
34
35     /**
36      * Retrieves the current item in the iteration. Behaves
37      * idempotently; calling getCurrent() repeatedly should return the same
38      * Object until the iteration is advanced. (Specifically, calling
39      * getCurrent() does <b>not</b> advance the iteration.)
40      *
41      * @return the current item as an object
42      */

43     public Object JavaDoc getCurrent();
44
45     /**
46      * Retrieves the index of the current round of the iteration. If
47      * iteration is being performed over a subset of an underlying
48      * array, java.lang.Collection, or other type, the index returned
49      * is absolute with respect to the underlying collection. Indices
50      * are 0-based.
51      *
52      * @return the 0-based index of the current round of the iteration
53      */

54     public int getIndex();
55
56     /**
57      * <p>Retrieves the "count" of the current round of the iteration. The
58      * count is a relative, 1-based sequence number identifying the
59      * current "round" of iteration (in context with all rounds the
60      * current iteration will perform).</p>
61      *
62      * <p>As an example, an iteration with begin = 5, end = 15, and step =
63      * 5 produces the counts 1, 2, and 3 in that order.</p>
64      *
65      * @return the 1-based count of the current round of the iteration
66      */

67     public int getCount();
68
69     /**
70      * Returns information about whether the current round of the
71      * iteration is the first one. This current round may be the 'first'
72      * even when getIndex() != 0, for 'index' refers to the absolute
73      * index of the current 'item' in the context of its underlying
74      * collection. It is always that case that a true result from
75      * isFirst() implies getCount() == 1.
76      *
77      * @return <tt>true</tt> if the current round is the first in the
78      * iteration, <tt>false</tt> otherwise.
79      */

80     public boolean isFirst();
81
82     /**
83      * Returns information about whether the current round of the
84      * iteration is the last one. As with isFirst(), subsetting is
85      * taken into account. isLast() doesn't necessarily refer to the
86      * status of the underlying Iterator; it refers to whether or not
87      * the current round will be the final round of iteration for the
88      * tag associated with this LoopTagStatus.
89      *
90      * @return <tt>true</tt> if the current round is the last in the
91      * iteration, <tt>false</tt> otherwise.
92      */

93     public boolean isLast();
94
95     /**
96      * Returns the value of the 'begin' attribute for the associated tag,
97      * or null if no 'begin' attribute was specified.
98      *
99      * @return the 'begin' value for the associated tag, or null
100      * if no 'begin' attribute was specified
101      */

102     public Integer JavaDoc getBegin();
103
104     /**
105      * Returns the value of the 'end' attribute for the associated tag,
106      * or null if no 'end' attribute was specified.
107      *
108      * @return the 'end' value for the associated tag, or null
109      * if no 'end' attribute was specified
110      */

111     public Integer JavaDoc getEnd();
112
113     /**
114      * Returns the value of the 'step' attribute for the associated tag,
115      * or null if no 'step' attribute was specified.
116      *
117      * @return the 'step' value for the associated tag, or null
118      * if no 'step' attribute was specified
119      */

120     public Integer JavaDoc getStep();
121
122 }
123
Popular Tags