public class IteratorStatus
extends java.lang.Object
iterator tag
can export an IteratorStatus object so that
one can get information about the status of the iteration, such as:
Example
<re:iter status="status" value='%{0, 1}'>
Index: <s:property value="%{#status.index}" /> <br>
Count: <s:property value="%{#status.count}" /> <br>
</re:iter>
will print
Index: 0 Count: 1 Index: 1 Count: 2
Modifier and Type | Field and Description |
---|---|
protected int |
count |
protected boolean |
last |
protected int |
modulus |
Constructor and Description |
---|
IteratorStatus() |
IteratorStatus(int modulus) |
Modifier and Type | Method and Description |
---|---|
int |
getCount()
Returns current item count (1-based).
|
int |
getIndex()
Returns current index (zero-based).
|
int |
getModulus()
Returns modulus of current count.
|
boolean |
isEven()
Returns
true if current count is even. |
boolean |
isFirst()
Returns
true if current item is the first one. |
boolean |
isLast()
Returns
true if current item is the last one. |
boolean |
isOdd()
Returns
true if current count is odd. |
int |
modulus(int operand)
Calculates modulus of current count.
|
protected void |
next(boolean isLast)
Performs the iterations to the next item and specifies if this is the last iteration.
|
java.lang.String |
toString() |
protected final int modulus
protected boolean last
protected int count
public IteratorStatus()
public IteratorStatus(int modulus)
public int getCount()
public int getIndex()
public boolean isEven()
true
if current count is even.public boolean isOdd()
true
if current count is odd.public int modulus(int operand)
public int getModulus()
public boolean isFirst()
true
if current item is the first one.public boolean isLast()
true
if current item is the last one.protected void next(boolean isLast)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2003-present Jodd Team