| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
| <!--NewPage-->
|
| <HTML>
|
| <HEAD>
|
| <!-- Generated by javadoc (build 1.4.2_08) on Mon Nov 14 10:15:17 PST 2005 -->
|
| <TITLE>
|
| IteratorTool (Velocity Tools 1.2 Documentation)
|
| </TITLE>
|
|
|
| <META NAME="keywords" CONTENT="org.apache.velocity.tools.generic.IteratorTool class">
|
|
|
| <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
|
|
|
| <SCRIPT type="text/javascript">
|
| function windowTitle()
|
| {
|
| parent.document.title="IteratorTool (Velocity Tools 1.2 Documentation)";
|
| }
|
| </SCRIPT>
|
|
|
| </HEAD>
|
|
|
| <BODY BGCOLOR="white" onload="windowTitle();">
|
|
|
| |
| <!-- ========= START OF TOP NAVBAR ======= -->
|
| <A NAME="navbar_top"><!-- --></A> |
| <A HREF="#skip-navbar_top" title="Skip navigation links"></A> |
| <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
| <TR>
|
| <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
| <A NAME="navbar_top_firstrow"><!-- --></A> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
| <TR ALIGN="center" VALIGN="top">
|
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
| <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
| </TR>
|
| </TABLE>
|
| </TD>
|
| <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
| </EM>
|
| </TD>
|
| </TR>
|
|
|
| <TR>
|
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
| <A HREF="../../../../../org/apache/velocity/tools/generic/EscapeTool.html" title="class in org.apache.velocity.tools.generic"><B>PREV CLASS</B></A>
|
| <A HREF="../../../../../org/apache/velocity/tools/generic/ListTool.html" title="class in org.apache.velocity.tools.generic"><B>NEXT CLASS</B></A></FONT></TD>
|
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
| <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>
|
| <A HREF="IteratorTool.html" target="_top"><B>NO FRAMES</B></A>
|
| <SCRIPT type="text/javascript">
|
| <!--
|
| if(window==top) {
|
| document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
| }
|
| //-->
|
| </SCRIPT>
|
| <NOSCRIPT>
|
| <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
|
| </NOSCRIPT> |
|
|
| </FONT></TD>
|
| </TR>
|
| <TR>
|
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
| SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
| DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
| </TR>
|
| </TABLE>
|
| <A NAME="skip-navbar_top"></A> |
| <!-- ========= END OF TOP NAVBAR ========= -->
|
|
|
| <HR>
|
| <!-- ======== START OF CLASS DATA ======== -->
|
| <H2>
|
| <FONT SIZE="-1">
|
| org.apache.velocity.tools.generic</FONT>
|
| <BR>
|
| Class IteratorTool</H2>
|
| <PRE>
|
| java.lang.Object
|
| <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by"><B>org.apache.velocity.tools.generic.IteratorTool</B>
|
| </PRE>
|
| <DL>
|
| <DT><B>All Implemented Interfaces:</B> <DD>java.util.Iterator</DD>
|
| </DL>
|
| <HR>
|
| <DL>
|
| <DT>public class <B>IteratorTool</B><DT>extends java.lang.Object<DT>implements java.util.Iterator</DL>
|
|
|
| <P>
|
| <p> |
| A convenience tool to use with #foreach loops. It wraps a list |
| to let the designer specify a condition to terminate the loop, |
| and reuse the same list in different loops. |
| </p> |
| <p> |
| Example of use: |
| <pre> |
| Java |
| ---- |
| context.put("mill", new IteratorTool()); |
| |
| |
| VTL |
| --- |
| |
| #set ($list = [1, 2, 3, 5, 8, 13]) |
| #set ($numbers = $mill.wrap($list)) |
| |
| #foreach ($item in $numbers) |
| #if ($item < 8) $numbers.more()#end |
| #end |
| |
| $numbers.more() |
| |
| |
| Output |
| ------ |
| |
| 1 2 3 5 |
| 8 |
| |
| Example toolbox.xml config (if you want to use this with VelocityView): |
| <tool> |
| <key>mill</key> |
| <scope>request</scope> |
| <class>org.apache.velocity.tools.generic.IteratorTool</class> |
| </tool> |
| </pre> |
| </p> |
| <p> |
| <b>Warning:</b> It is not recommended to use hasNext() with this |
| tool as it is used to control the #foreach. Use hasMore() instead. |
| </p>
|
| <P>
|
|
|
| <P>
|
| <DL>
|
| <DT><B>Version:</B></DT> |
| <DD>$Id: IteratorTool.java 233420 2005-08-19 03:50:14Z nbubna $</DD> |
| <DT><B>Author:</B></DT> |
| <DD><a href="mailto:jido@respublica.fr">Denis Bredelet</a></DD> |
| </DL>
|
| <HR>
|
|
|
| <P>
|
| <!-- ======== NESTED CLASS SUMMARY ======== -->
|
|
|
|
|
| <!-- =========== FIELD SUMMARY =========== -->
|
|
|
| <A NAME="field_summary"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
| <TD COLSPAN=2><FONT SIZE="+2">
|
| <B>Field Summary</B></FONT></TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
| <CODE>private boolean</CODE></FONT></TD>
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#cachedNext">cachedNext</A></B></CODE>
|
|
|
| <BR>
|
| </TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
| <CODE>private java.util.Iterator</CODE></FONT></TD>
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#iterator">iterator</A></B></CODE>
|
|
|
| <BR>
|
| </TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
| <CODE>protected java.lang.Object</CODE></FONT></TD>
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#next">next</A></B></CODE>
|
|
|
| <BR>
|
| </TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
| <CODE>private boolean</CODE></FONT></TD>
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#wantMore">wantMore</A></B></CODE>
|
|
|
| <BR>
|
| </TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
| <CODE>private java.lang.Object</CODE></FONT></TD>
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#wrapped">wrapped</A></B></CODE>
|
|
|
| <BR>
|
| </TD>
|
| </TR>
|
| </TABLE>
|
|
|
| <!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
|
| <A NAME="constructor_summary"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
| <TD COLSPAN=2><FONT SIZE="+2">
|
| <B>Constructor Summary</B></FONT></TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#IteratorTool()">IteratorTool</A></B>()</CODE>
|
|
|
| <BR>
|
| Create a IteratorTool instance to use as tool.</TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#IteratorTool(java.lang.Object)">IteratorTool</A></B>(java.lang.Object wrapped)</CODE>
|
|
|
| <BR>
|
| Create a IteratorTool instance to use in #foreach.</TD>
|
| </TR>
|
| </TABLE>
|
|
|
| <!-- ========== METHOD SUMMARY =========== -->
|
|
|
| <A NAME="method_summary"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
| <TD COLSPAN=2><FONT SIZE="+2">
|
| <B>Method Summary</B></FONT></TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
| <CODE> boolean</CODE></FONT></TD>
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#hasMore()">hasMore</A></B>()</CODE>
|
|
|
| <BR>
|
| Returns true if there are more elements in the wrapped list.</TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
| <CODE> boolean</CODE></FONT></TD>
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#hasNext()">hasNext</A></B>()</CODE>
|
|
|
| <BR>
|
| Returns true if there are more elements in the |
| list and more() was called.</TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
| <CODE>private void</CODE></FONT></TD>
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#internalWrap(java.lang.Object)">internalWrap</A></B>(java.lang.Object wrapped)</CODE>
|
|
|
| <BR>
|
| Wraps a list with the tool.</TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
| <CODE> java.lang.Object</CODE></FONT></TD>
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#more()">more</A></B>()</CODE>
|
|
|
| <BR>
|
| |
| Asks for the next element in the list.</TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
| <CODE> java.lang.Object</CODE></FONT></TD>
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#next()">next</A></B>()</CODE>
|
|
|
| <BR>
|
| |
| Gets the next object in the list.</TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
| <CODE> void</CODE></FONT></TD>
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#remove()">remove</A></B>()</CODE>
|
|
|
| <BR>
|
| Removes the current element from the list.</TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
| <CODE> void</CODE></FONT></TD>
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#reset()">reset</A></B>()</CODE>
|
|
|
| <BR>
|
| |
| Resets the wrapper so that it starts over at the beginning of the list.</TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
| <CODE> void</CODE></FONT></TD>
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#stop()">stop</A></B>()</CODE>
|
|
|
| <BR>
|
| Puts a condition to break out of the loop.</TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
| <CODE> java.lang.String</CODE></FONT></TD>
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#toString()">toString</A></B>()</CODE>
|
|
|
| <BR>
|
| Returns this object as a String.</TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
| <CODE> <A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html" title="class in org.apache.velocity.tools.generic">IteratorTool</A></CODE></FONT></TD>
|
| <TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html#wrap(java.lang.Object)">wrap</A></B>(java.lang.Object list)</CODE>
|
|
|
| <BR>
|
| Wraps a list with the tool.</TD>
|
| </TR>
|
| </TABLE>
|
| <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
| <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
|
| <TD><B>Methods inherited from class java.lang.Object</B></TD>
|
| </TR>
|
| <TR BGCOLOR="white" CLASS="TableRowColor">
|
| <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD>
|
| </TR>
|
| </TABLE>
|
|
|
| <P>
|
|
|
| <!-- ============ FIELD DETAIL =========== -->
|
|
|
| <A NAME="field_detail"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
| <TD COLSPAN=1><FONT SIZE="+2">
|
| <B>Field Detail</B></FONT></TD>
|
| </TR>
|
| </TABLE>
|
|
|
| <A NAME="wrapped"><!-- --></A><H3>
|
| wrapped</H3>
|
| <PRE>
|
| private java.lang.Object <B>wrapped</B></PRE>
|
| <DL>
|
| <DL>
|
| </DL>
|
| </DL>
|
| <HR>
|
|
|
| <A NAME="iterator"><!-- --></A><H3>
|
| iterator</H3>
|
| <PRE>
|
| private java.util.Iterator <B>iterator</B></PRE>
|
| <DL>
|
| <DL>
|
| </DL>
|
| </DL>
|
| <HR>
|
|
|
| <A NAME="wantMore"><!-- --></A><H3>
|
| wantMore</H3>
|
| <PRE>
|
| private boolean <B>wantMore</B></PRE>
|
| <DL>
|
| <DL>
|
| </DL>
|
| </DL>
|
| <HR>
|
|
|
| <A NAME="cachedNext"><!-- --></A><H3>
|
| cachedNext</H3>
|
| <PRE>
|
| private boolean <B>cachedNext</B></PRE>
|
| <DL>
|
| <DL>
|
| </DL>
|
| </DL>
|
| <HR>
|
|
|
| <A NAME="next"><!-- --></A><H3>
|
| next</H3>
|
| <PRE>
|
| protected java.lang.Object <B>next</B></PRE>
|
| <DL>
|
| <DL>
|
| </DL>
|
| </DL>
|
|
|
| <!-- ========= CONSTRUCTOR DETAIL ======== -->
|
|
|
| <A NAME="constructor_detail"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
| <TD COLSPAN=1><FONT SIZE="+2">
|
| <B>Constructor Detail</B></FONT></TD>
|
| </TR>
|
| </TABLE>
|
|
|
| <A NAME="IteratorTool()"><!-- --></A><H3>
|
| IteratorTool</H3>
|
| <PRE>
|
| public <B>IteratorTool</B>()</PRE>
|
| <DL>
|
| <DD>Create a IteratorTool instance to use as tool. |
| When it is created this way, the tool returns a new |
| instance each time wrap() is called. This is |
| useful when you want to allow the designers to create instances.
|
| <P>
|
| </DL>
|
| <HR>
|
|
|
| <A NAME="IteratorTool(java.lang.Object)"><!-- --></A><H3>
|
| IteratorTool</H3>
|
| <PRE>
|
| public <B>IteratorTool</B>(java.lang.Object wrapped)</PRE>
|
| <DL>
|
| <DD>Create a IteratorTool instance to use in #foreach.
|
| <P>
|
| <DT><B>Parameters:</B><DD><CODE>wrapped</CODE> - The list to wrap.</DL>
|
|
|
| <!-- ============ METHOD DETAIL ========== -->
|
|
|
| <A NAME="method_detail"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
| <TD COLSPAN=1><FONT SIZE="+2">
|
| <B>Method Detail</B></FONT></TD>
|
| </TR>
|
| </TABLE>
|
|
|
| <A NAME="wrap(java.lang.Object)"><!-- --></A><H3>
|
| wrap</H3>
|
| <PRE>
|
| public <A HREF="../../../../../org/apache/velocity/tools/generic/IteratorTool.html" title="class in org.apache.velocity.tools.generic">IteratorTool</A> <B>wrap</B>(java.lang.Object list)</PRE>
|
| <DL>
|
| <DD>Wraps a list with the tool. |
| <br>The list can be an array, a Collection, a Map, an Iterator |
| or an Enumeration. |
| <br>If the list is a Map, the tool iterates over the values. |
| <br>If the list is an Iterator or an Enumeration, the tool can |
| be used only once.
|
| <P>
|
| <DD><DL>
|
| </DL>
|
| </DD>
|
| <DD><DL>
|
| <DT><B>Parameters:</B><DD><CODE>list</CODE> - The list to wrap. |
| <DT><B>Returns:</B><DD>A new wrapper if this object is used as a tool, or |
| itself if it is a wrapper.</DL>
|
| </DD>
|
| </DL>
|
| <HR>
|
|
|
| <A NAME="internalWrap(java.lang.Object)"><!-- --></A><H3>
|
| internalWrap</H3>
|
| <PRE>
|
| private void <B>internalWrap</B>(java.lang.Object wrapped)</PRE>
|
| <DL>
|
| <DD>Wraps a list with the tool. This object can therefore |
| be used instead of the list itself in a #foreach. |
| The list can be an array, a Collection, a Map, an |
| Iterator or an Enumeration. |
| <br>- If the list is a Map, the tool iterates over the values. |
| <br>- If the list is an Iterator or an Enumeration, the tool |
| can be used only once.
|
| <P>
|
| <DD><DL>
|
| </DL>
|
| </DD>
|
| <DD><DL>
|
| <DT><B>Parameters:</B><DD><CODE>wrapped</CODE> - The list to wrap.</DL>
|
| </DD>
|
| </DL>
|
| <HR>
|
|
|
| <A NAME="reset()"><!-- --></A><H3>
|
| reset</H3>
|
| <PRE>
|
| public void <B>reset</B>()</PRE>
|
| <DL>
|
| <DD><p> |
| Resets the wrapper so that it starts over at the beginning of the list. |
| </p> |
| <p> |
| <b>Note to programmers:</b> This method has no effect if the wrapped |
| object is an enumeration or an iterator.
|
| <P>
|
| <DD><DL>
|
| </DL>
|
| </DD>
|
| <DD><DL>
|
| </DL>
|
| </DD>
|
| </DL>
|
| <HR>
|
|
|
| <A NAME="next()"><!-- --></A><H3>
|
| next</H3>
|
| <PRE>
|
| public java.lang.Object <B>next</B>()</PRE>
|
| <DL>
|
| <DD><p> |
| Gets the next object in the list. This method is called |
| by #foreach to define $item in: |
| <pre> |
| #foreach( $item in $list ) |
| </pre> |
| </p> |
| <p> |
| This method is not intended for template designers, but they can use |
| them if they want to read the value of the next item without doing |
| more(). |
| </p>
|
| <P>
|
| <DD><DL>
|
| <DT><B>Specified by:</B><DD><CODE>next</CODE> in interface <CODE>java.util.Iterator</CODE></DL>
|
| </DD>
|
| <DD><DL>
|
| |
| <DT><B>Returns:</B><DD>The next item in the list. |
| <DT><B>Throws:</B> |
| <DD><CODE>NoSuchElementException</CODE> - if there are no more |
| elements in the list.</DL>
|
| </DD>
|
| </DL>
|
| <HR>
|
|
|
| <A NAME="hasNext()"><!-- --></A><H3>
|
| hasNext</H3>
|
| <PRE>
|
| public boolean <B>hasNext</B>()</PRE>
|
| <DL>
|
| <DD>Returns true if there are more elements in the |
| list and more() was called. |
| <br>This code always return false: |
| <pre> |
| tool.hasNext()? tool.hasNext(): false; |
| </pre>
|
| <P>
|
| <DD><DL>
|
| <DT><B>Specified by:</B><DD><CODE>hasNext</CODE> in interface <CODE>java.util.Iterator</CODE></DL>
|
| </DD>
|
| <DD><DL>
|
| |
| <DT><B>Returns:</B><DD>true if there are more elements, and either more() |
| or hasNext() was called since last call.</DL>
|
| </DD>
|
| </DL>
|
| <HR>
|
|
|
| <A NAME="remove()"><!-- --></A><H3>
|
| remove</H3>
|
| <PRE>
|
| public void <B>remove</B>() |
| throws java.lang.UnsupportedOperationException</PRE>
|
| <DL>
|
| <DD>Removes the current element from the list. |
| The current element is defined as the last element that was read |
| from the list, either with next() or with more().
|
| <P>
|
| <DD><DL>
|
| <DT><B>Specified by:</B><DD><CODE>remove</CODE> in interface <CODE>java.util.Iterator</CODE></DL>
|
| </DD>
|
| <DD><DL>
|
| |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.UnsupportedOperationException</CODE> - if the wrapped list |
| iterator doesn't support this operation.</DL>
|
| </DD>
|
| </DL>
|
| <HR>
|
|
|
| <A NAME="more()"><!-- --></A><H3>
|
| more</H3>
|
| <PRE>
|
| public java.lang.Object <B>more</B>()</PRE>
|
| <DL>
|
| <DD><p> |
| Asks for the next element in the list. This method is to be used |
| by the template designer in #foreach loops. |
| </p> |
| <p> |
| If this method is called in the body of #foreach, the loop |
| continues as long as there are elements in the list. |
| <br>If this method is not called the loop terminates after the |
| current iteration. |
| </p>
|
| <P>
|
| <DD><DL>
|
| </DL>
|
| </DD>
|
| <DD><DL>
|
| |
| <DT><B>Returns:</B><DD>The next element in the list, or null if there are no |
| more elements.</DL>
|
| </DD>
|
| </DL>
|
| <HR>
|
|
|
| <A NAME="hasMore()"><!-- --></A><H3>
|
| hasMore</H3>
|
| <PRE>
|
| public boolean <B>hasMore</B>()</PRE>
|
| <DL>
|
| <DD>Returns true if there are more elements in the wrapped list. |
| <br>If this object doesn't wrap a list, the method always returns false.
|
| <P>
|
| <DD><DL>
|
| </DL>
|
| </DD>
|
| <DD><DL>
|
| |
| <DT><B>Returns:</B><DD>true if there are more elements in the list.</DL>
|
| </DD>
|
| </DL>
|
| <HR>
|
|
|
| <A NAME="stop()"><!-- --></A><H3>
|
| stop</H3>
|
| <PRE>
|
| public void <B>stop</B>()</PRE>
|
| <DL>
|
| <DD>Puts a condition to break out of the loop. |
| The #foreach loop will terminate after this iteration, unless more() |
| is called after stop().
|
| <P>
|
| <DD><DL>
|
| </DL>
|
| </DD>
|
| <DD><DL>
|
| </DL>
|
| </DD>
|
| </DL>
|
| <HR>
|
|
|
| <A NAME="toString()"><!-- --></A><H3>
|
| toString</H3>
|
| <PRE>
|
| public java.lang.String <B>toString</B>()</PRE>
|
| <DL>
|
| <DD>Returns this object as a String. |
| <br>If this object is used as a tool, it just gives the class name. |
| <br>Otherwise it appends the wrapped list to the class name.
|
| <P>
|
| <DD><DL>
|
| </DL>
|
| </DD>
|
| <DD><DL>
|
| |
| <DT><B>Returns:</B><DD>A string representation of this object.</DL>
|
| </DD>
|
| </DL>
|
| <!-- ========= END OF CLASS DATA ========= -->
|
| <HR>
|
|
|
| |
| <!-- ======= START OF BOTTOM NAVBAR ====== -->
|
| <A NAME="navbar_bottom"><!-- --></A> |
| <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> |
| <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
| <TR>
|
| <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
| <A NAME="navbar_bottom_firstrow"><!-- --></A> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
| <TR ALIGN="center" VALIGN="top">
|
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
| <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
| </TR>
|
| </TABLE>
|
| </TD>
|
| <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
| </EM>
|
| </TD>
|
| </TR>
|
|
|
| <TR>
|
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
| <A HREF="../../../../../org/apache/velocity/tools/generic/EscapeTool.html" title="class in org.apache.velocity.tools.generic"><B>PREV CLASS</B></A>
|
| <A HREF="../../../../../org/apache/velocity/tools/generic/ListTool.html" title="class in org.apache.velocity.tools.generic"><B>NEXT CLASS</B></A></FONT></TD>
|
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
| <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>
|
| <A HREF="IteratorTool.html" target="_top"><B>NO FRAMES</B></A>
|
| <SCRIPT type="text/javascript">
|
| <!--
|
| if(window==top) {
|
| document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
| }
|
| //-->
|
| </SCRIPT>
|
| <NOSCRIPT>
|
| <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
|
| </NOSCRIPT> |
|
|
| </FONT></TD>
|
| </TR>
|
| <TR>
|
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
| SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
| DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
| </TR>
|
| </TABLE>
|
| <A NAME="skip-navbar_bottom"></A> |
| <!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
|
| <HR>
|
| Copyright (c) 2003 Apache Software Foundation
|
| </BODY>
|
| </HTML>
|