blob: 94b96148f557637da4e715a8e6bf714c9bb1a781 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_171) on Wed Jun 20 14:25:31 CEST 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LoopTool (VelocityTools 3.0-SNAPSHOT API)</title>
<meta name="date" content="2018-06-20">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="LoopTool (VelocityTools 3.0-SNAPSHOT API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/LoopTool.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/velocity/tools/generic/LogTool.html" title="class in org.apache.velocity.tools.generic"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.Action.html" title="enum in org.apache.velocity.tools.generic"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/velocity/tools/generic/LoopTool.html" target="_top">Frames</a></li>
<li><a href="LoopTool.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.org.apache.velocity.tools.generic.SafeConfig">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.velocity.tools.generic</div>
<h2 title="Class LoopTool" class="title">Class LoopTool</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html" title="class in org.apache.velocity.tools.generic">org.apache.velocity.tools.generic.SafeConfig</a></li>
<li>
<ul class="inheritance">
<li>org.apache.velocity.tools.generic.LoopTool</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre><a href="../../../../../org/apache/velocity/tools/config/DefaultKey.html" title="annotation in org.apache.velocity.tools.config">@DefaultKey</a>(<a href="../../../../../org/apache/velocity/tools/config/DefaultKey.html#value--">value</a>="loop")
<a href="../../../../../org/apache/velocity/tools/config/ValidScope.html" title="annotation in org.apache.velocity.tools.config">@ValidScope</a>(<a href="../../../../../org/apache/velocity/tools/config/ValidScope.html#value--">value</a>="request")
public class <span class="typeNameLabel">LoopTool</span>
extends <a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html" title="class in org.apache.velocity.tools.generic">SafeConfig</a></pre>
<div class="block"><p>
A convenience tool to use with #foreach loops. It wraps a list
with a custom iterator to provide additional controls and feedback
for managing loops.
</p>
<p>
This tool was originally inspired the now-deprecated IteratorTool,
which provided similar base functionality but was somewhat more difficult
to understand and use. Rather than try to migrate that implementation
via deprecation and new methods, it was simplest to just create an
entirely new tool that simplified the original API and was easy
to augment with useful new features like support for nested
(and nameable) loops, skipping ahead in loops, synchronizing multiple
iterators, getting the iteration count of loops, identifying if a loop is
on its first or last iteration, and so on.
</p>
<p>
Most functions of this tool will be obsolete with the release of
Velocity 1.7, which will provide $foreach.hasNext, $foreach.isFirst,
$foreach.isLast, $foreach.index and $foreach.count automatically.
However, this will still be useful for the more advanced sync
and skip features. Also, for very complicated nested loops, the
loop naming feature may be easier than doing things like $foreach.parent.parent.
</p>
<p>
Example of use:
</p>
<pre>
Template
---
#set( $list = [1..7] )
#set( $others = [3..10] )
#foreach( $item in $loop.watch($list).sync($others, 'other') )
$item -&gt; $loop.other
#if( $item &gt;= 5 )$loop.stop()#end
#end
Output
------
1 -&gt; 3
2 -&gt; 4
3 -&gt; 5
4 -&gt; 6
5 -&gt; 7
Example tools.xml config (if you want to use this with VelocityView):
&lt;tools&gt;
&lt;toolbox scope="request"&gt;
&lt;tool class="org.apache.velocity.tools.generic.LoopTool"/&gt;
&lt;/toolbox&gt;
&lt;/tools&gt;
</pre></div>
<dl>
<dt><span class="simpleTagLabel">Version:</span></dt>
<dd>$Id: LoopTool.java 590893 2007-11-01 04:40:21Z nbubna $</dd>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd>Nathan Bubna</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.Action.html" title="enum in org.apache.velocity.tools.generic">LoopTool.Action</a></span></code>
<div class="block">Represents an automatic action taken by a <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic"><code>LoopTool.ManagedIterator</code></a>
when a <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.Condition.html" title="interface in org.apache.velocity.tools.generic"><code>LoopTool.Condition</code></a> is satisfied by the subsequent element.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ActionCondition.html" title="class in org.apache.velocity.tools.generic">LoopTool.ActionCondition</a></span></code>
<div class="block">Composition class which associates an <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.Action.html" title="enum in org.apache.velocity.tools.generic"><code>LoopTool.Action</code></a> and <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.Condition.html" title="interface in org.apache.velocity.tools.generic"><code>LoopTool.Condition</code></a>
for a <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic"><code>LoopTool.ManagedIterator</code></a>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.Comparison.html" title="class in org.apache.velocity.tools.generic">LoopTool.Comparison</a></span></code>
<div class="block">Base condition class for conditions (assumption here is that
conditions are all comparative.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static interface&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.Condition.html" title="interface in org.apache.velocity.tools.generic">LoopTool.Condition</a></span></code>
<div class="block">Represents a function into which a <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic"><code>LoopTool.ManagedIterator</code></a> can
pass it's next element to see if an <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.Action.html" title="enum in org.apache.velocity.tools.generic"><code>LoopTool.Action</code></a> should be taken.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.Equals.html" title="class in org.apache.velocity.tools.generic">LoopTool.Equals</a></span></code>
<div class="block">Simple condition that checks elements in the iterator
for equality to a specified Object.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.ManagedIterator</a></span></code>
<div class="block">Iterator implementation that wraps a standard <a href="https://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util"><code>Iterator</code></a>
and allows it to be prematurely stopped, skipped ahead, and
associated with a name for advanced nested loop control.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.SyncedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.SyncedIterator</a></span></code>
<div class="block">Simple wrapper to make it easy to keep an arbitray Iterator
in sync with a <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic"><code>LoopTool.ManagedIterator</code></a>.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.org.apache.velocity.tools.generic.SafeConfig">
<!-- -->
</a>
<h3>Fields inherited from class&nbsp;org.apache.velocity.tools.generic.<a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html" title="class in org.apache.velocity.tools.generic">SafeConfig</a></h3>
<code><a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html#LOCK_CONFIG_KEY">LOCK_CONFIG_KEY</a>, <a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html#log">log</a>, <a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html#LOGGER_NAME_KEY">LOGGER_NAME_KEY</a>, <a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html#SAFE_MODE_KEY">SAFE_MODE_KEY</a>, <a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html#USE_CLASS_LOGGER_KEY">USE_CLASS_LOGGER_KEY</a></code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#LoopTool--">LoopTool</a></span>()</code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>protected <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.ManagedIterator</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#findIterator-java.lang.String-">findIterator</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</code>
<div class="block">Finds the <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic"><code>LoopTool.ManagedIterator</code></a> with the specified name
if it is in this instance's iterator stack.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#get-java.lang.String-">get</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;key)</code>
<div class="block">This serves two purposes:</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#get-java.lang.String-java.lang.String-">get</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name,
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;synced)</code>
<div class="block">Asks the loop with the specified name for the current value
of the specified sync'ed iterator, if any.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#getCount--">getCount</a></span>()</code>
<div class="block">Returns the number of items the current loop has handled.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#getCount-java.lang.String-">getCount</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</code>
<div class="block">Returns the number of items the specified loop has handled.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#getDepth--">getDepth</a></span>()</code>
<div class="block">Returns the number of loops currently on the stack.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#getFirst--">getFirst</a></span>()</code>
<div class="block">Returns the result of <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#isFirst--"><code>isFirst()</code></a>.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#getIndex--">getIndex</a></span>()</code>
<div class="block">Returns the 0-based index of the item the current loop is handling.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#getIndex-java.lang.String-">getIndex</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</code>
<div class="block">Returns the 0-based index of the item the specified loop is handling.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>protected <a href="https://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#getIterator-java.lang.Object-">getIterator</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;obj)</code>
<div class="block">Wraps access to <a href="../../../../../org/apache/velocity/tools/ClassUtils.html#getIterator-java.lang.Object-"><code>ClassUtils.getIterator(java.lang.Object)</code></a> is a
nice little try/catch block to prevent exceptions from
escaping into the template.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#getLast--">getLast</a></span>()</code>
<div class="block">Returns the result of <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#isLast--"><code>isLast()</code></a>.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.ManagedIterator</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#getThis--">getThis</a></span>()</code>
<div class="block">Returns the most recent <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic"><code>LoopTool.ManagedIterator</code></a> for this instance.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#isFirst--">isFirst</a></span>()</code>
<div class="block">Returns <code>true</code> if the current loop is on its first iteration.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#isFirst-java.lang.String-">isFirst</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</code>
<div class="block">Returns <code>true</code> if the loop with the specified name
is on its first iteration.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#isLast--">isLast</a></span>()</code>
<div class="block">Returns <code>true</code> if the current loop is on its last iteration.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#isLast-java.lang.String-">isLast</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</code>
<div class="block">Returns <code>true</code> if the loop with the specified name
is on its last iteration.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>protected <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.ManagedIterator</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#manage-java.util.Iterator-java.lang.String-">manage</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</a>&nbsp;iterator,
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</code>&nbsp;</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>protected <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.ManagedIterator</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#pop--">pop</a></span>()</code>
<div class="block">Don't let templates call this, but allow subclasses
and ManagedIterator to have access.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#skip-int-">skip</a></span>(int&nbsp;number)</code>
<div class="block">Skips ahead the specified number of iterations (if possible).</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#skip-int-java.lang.String-">skip</a></span>(int&nbsp;number,
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</code>
<div class="block">This tells the specified loop to skip ahead the specified number of
iterations.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#stop--">stop</a></span>()</code>
<div class="block">This tells the current loop to stop after the current iteration.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#stop-java.lang.String-">stop</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</code>
<div class="block">This is just like <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#stop--"><code>stop()</code></a> except that the stop command is issued
<strong>only</strong> to the loop/iterator with the specified name.</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#stopAll--">stopAll</a></span>()</code>
<div class="block">This is just like <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#stop--"><code>stop()</code></a> except that the stop command is issued
<strong>all</strong> the loops being watched by this tool.</div>
</td>
</tr>
<tr id="i23" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#stopTo-java.lang.String-">stopTo</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</code>
<div class="block">This is just like <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#stop-java.lang.String-"><code>stop(String)</code></a> except that the stop command is issued
both to the loop/iterator with the specified name and all loops nested within
it.</div>
</td>
</tr>
<tr id="i24" class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.ManagedIterator</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#sync-java.lang.Object-java.lang.Object-">sync</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;main,
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;synced)</code>&nbsp;</td>
</tr>
<tr id="i25" class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.ManagedIterator</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#watch-java.lang.Object-">watch</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;obj)</code>
<div class="block">Tells the LoopTool to watch the specified Array, Collection, Map,
Iterator, Iterable, Enumeration or POJO with an iterator() method
while the template iterates over the values within it.</div>
</td>
</tr>
<tr id="i26" class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.ManagedIterator</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#watch-java.lang.Object-java.lang.String-">watch</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;obj,
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</code>
<div class="block">This is just like <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#watch-java.lang.Object-"><code>watch(Object)</code></a> except that it also takes
a name which is given to the <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic"><code>LoopTool.ManagedIterator</code></a> that is returned.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.org.apache.velocity.tools.generic.SafeConfig">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;org.apache.velocity.tools.generic.<a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html" title="class in org.apache.velocity.tools.generic">SafeConfig</a></h3>
<code><a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html#configure-java.util.Map-">configure</a>, <a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html#configure-org.apache.velocity.tools.generic.ValueParser-">configure</a>, <a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html#getLog--">getLog</a>, <a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html#initLogger-org.apache.velocity.tools.generic.ValueParser-">initLogger</a>, <a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html#isConfigLocked--">isConfigLocked</a>, <a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html#isSafeMode--">isSafeMode</a>, <a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html#setLockConfig-boolean-">setLockConfig</a>, <a href="../../../../../org/apache/velocity/tools/generic/SafeConfig.html#setSafeMode-boolean-">setSafeMode</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="LoopTool--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>LoopTool</h4>
<pre>public&nbsp;LoopTool()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="watch-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>watch</h4>
<pre>public&nbsp;<a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.ManagedIterator</a>&nbsp;watch(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;obj)</pre>
<div class="block"><p>Tells the LoopTool to watch the specified Array, Collection, Map,
Iterator, Iterable, Enumeration or POJO with an iterator() method
while the template iterates over the values within it.
</p>
<p>Under the covers, this is returning an iterable wrapper that
is also pushed onto this tool's stack. That allows this tool to
know which iterator to give later commands (i.e. stop() or skip()).
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>obj</code> - an object that Velocity's #foreach directive can iterate over</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic"><code>LoopTool.ManagedIterator</code></a> that this tool instance will track</dd>
</dl>
</li>
</ul>
<a name="watch-java.lang.Object-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>watch</h4>
<pre>public&nbsp;<a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.ManagedIterator</a>&nbsp;watch(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;obj,
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</pre>
<div class="block">This is just like <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#watch-java.lang.Object-"><code>watch(Object)</code></a> except that it also takes
a name which is given to the <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic"><code>LoopTool.ManagedIterator</code></a> that is returned.
This allows the user to send stop or skip commands to that specific
iterator even when there are nested iterators within it that are being
watched. If the given name is <code>null</code>, then this will return
<code>null</code> even if the object can be watched. Provided names cannot
be <code>null</code>.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#watch-java.lang.Object-"><code>watch(Object)</code></a></dd>
</dl>
</li>
</ul>
<a name="sync-java.lang.Object-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>sync</h4>
<pre>public&nbsp;<a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.ManagedIterator</a>&nbsp;sync(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;main,
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;synced)</pre>
</li>
</ul>
<a name="manage-java.util.Iterator-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>manage</h4>
<pre>protected&nbsp;<a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.ManagedIterator</a>&nbsp;manage(<a href="https://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</a>&nbsp;iterator,
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</pre>
</li>
</ul>
<a name="stop--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>stop</h4>
<pre>public&nbsp;void&nbsp;stop()</pre>
<div class="block">This tells the current loop to stop after the current iteration.
This is different from "break" common to most programming languages,
in that it does not immediately cease activity in the current iteration.
Instead, it merely tells the #foreach loop that this is the last time
around.</div>
</li>
</ul>
<a name="stop-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>stop</h4>
<pre>public&nbsp;void&nbsp;stop(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</pre>
<div class="block">This is just like <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#stop--"><code>stop()</code></a> except that the stop command is issued
<strong>only</strong> to the loop/iterator with the specified name.
If no such loop is found with that name, then no stop command is issued.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#stop--"><code>stop()</code></a></dd>
</dl>
</li>
</ul>
<a name="stopTo-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>stopTo</h4>
<pre>public&nbsp;void&nbsp;stopTo(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</pre>
<div class="block">This is just like <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#stop-java.lang.String-"><code>stop(String)</code></a> except that the stop command is issued
both to the loop/iterator with the specified name and all loops nested within
it. If no such loop is found with that name, then no stop commands are
issued.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#stop--"><code>stop()</code></a>,
<a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#stop-java.lang.String-"><code>stop(String)</code></a></dd>
</dl>
</li>
</ul>
<a name="stopAll--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>stopAll</h4>
<pre>public&nbsp;void&nbsp;stopAll()</pre>
<div class="block">This is just like <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#stop--"><code>stop()</code></a> except that the stop command is issued
<strong>all</strong> the loops being watched by this tool.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#stop--"><code>stop()</code></a></dd>
</dl>
</li>
</ul>
<a name="skip-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>skip</h4>
<pre>public&nbsp;void&nbsp;skip(int&nbsp;number)</pre>
<div class="block">Skips ahead the specified number of iterations (if possible).
Since this is manual skipping (unlike the automatic skipping
provided by the likes of <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html#exclude-java.lang.Object-"><code>LoopTool.ManagedIterator.exclude(Object)</code></a>, any elements
skipped are still considered in the results returned by <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#getCount--"><code>getCount()</code></a>
and <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#isFirst--"><code>isFirst()</code></a>.</div>
</li>
</ul>
<a name="skip-int-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>skip</h4>
<pre>public&nbsp;void&nbsp;skip(int&nbsp;number,
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</pre>
<div class="block">This tells the specified loop to skip ahead the specified number of
iterations.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#skip-int-"><code>skip(int)</code></a></dd>
</dl>
</li>
</ul>
<a name="isFirst--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isFirst</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</a>&nbsp;isFirst()</pre>
<div class="block">Returns <code>true</code> if the current loop is on its first iteration.</div>
</li>
</ul>
<a name="isFirst-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isFirst</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</a>&nbsp;isFirst(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</pre>
<div class="block">Returns <code>true</code> if the loop with the specified name
is on its first iteration.</div>
</li>
</ul>
<a name="getFirst--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getFirst</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</a>&nbsp;getFirst()</pre>
<div class="block">Returns the result of <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#isFirst--"><code>isFirst()</code></a>. Exists to allow $loop.first syntax.</div>
</li>
</ul>
<a name="isLast--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isLast</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</a>&nbsp;isLast()</pre>
<div class="block">Returns <code>true</code> if the current loop is on its last iteration.</div>
</li>
</ul>
<a name="isLast-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isLast</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</a>&nbsp;isLast(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</pre>
<div class="block">Returns <code>true</code> if the loop with the specified name
is on its last iteration.</div>
</li>
</ul>
<a name="getLast--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLast</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</a>&nbsp;getLast()</pre>
<div class="block">Returns the result of <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#isLast--"><code>isLast()</code></a>. Exists to allow $loop.last syntax.</div>
</li>
</ul>
<a name="get-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>get</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;get(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;key)</pre>
<div class="block"><p>This serves two purposes:</p>
<ul><li>Getting the current value of a sync'ed iterator</li>
<li>Abbreviate syntax for properties of outer loops</li></ul>
<p>First, it searches all the loops being managed for one
with a sync'ed Iterator under the specified name and
returns the current value for that sync'ed iterator,
if any. If there is no sync'ed iterators or none with
that name, then this will check if the specified key
is requesting a "property" of an outer loop (e.g.
<code>$loop.count_foo</code> or <code>$loop.first_foo</code>).
This syntax is shorter and clearer than <code>$loop.getCount('foo')</code>.
If the key starts with a property name and ends with an outer loop
name, then the value of that property for that loop is returned.</div>
</li>
</ul>
<a name="get-java.lang.String-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>get</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;get(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name,
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;synced)</pre>
<div class="block">Asks the loop with the specified name for the current value
of the specified sync'ed iterator, if any.</div>
</li>
</ul>
<a name="getIndex--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getIndex</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</a>&nbsp;getIndex()</pre>
<div class="block">Returns the 0-based index of the item the current loop is handling.
So, if this is the first iteration, then the index will be 0. If
you <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#skip-int-"><code>skip(int)</code></a> ahead in this loop, those skipped iterations will
still be reflected in the index. If iteration has not begun, this
will return <code>null</code>.</div>
</li>
</ul>
<a name="getIndex-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getIndex</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</a>&nbsp;getIndex(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</pre>
<div class="block">Returns the 0-based index of the item the specified loop is handling.
So, if this is the first iteration, then the index will be 0. If
you <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#skip-int-"><code>skip(int)</code></a> ahead in this loop, those skipped iterations will
still be reflected in the index. If iteration has not begun, this
will return <code>null</code>.</div>
</li>
</ul>
<a name="getCount--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCount</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</a>&nbsp;getCount()</pre>
<div class="block">Returns the number of items the current loop has handled. So, if this
is the first iteration, then the count will be 1. If you <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#skip-int-"><code>skip(int)</code></a>
ahead in this loop, those skipped iterations will still be included in
the count.</div>
</li>
</ul>
<a name="getCount-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCount</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</a>&nbsp;getCount(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</pre>
<div class="block">Returns the number of items the specified loop has handled. So, if this
is the first iteration, then the count will be 1. If you <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.html#skip-int-"><code>skip(int)</code></a>
ahead in this loop, those skipped iterations will still be included in
the count.</div>
</li>
</ul>
<a name="getThis--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getThis</h4>
<pre>public&nbsp;<a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.ManagedIterator</a>&nbsp;getThis()</pre>
<div class="block">Returns the most recent <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic"><code>LoopTool.ManagedIterator</code></a> for this instance.
This can be used to access properties like the count, index,
isFirst, isLast, etc which would otherwise fail on the last item
in a loop due to the necessity of popping iterators off the
stack when the last item is retrieved. (See VELTOOLS-124)</div>
</li>
</ul>
<a name="getDepth--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDepth</h4>
<pre>public&nbsp;int&nbsp;getDepth()</pre>
<div class="block">Returns the number of loops currently on the stack.
This is only useful for debugging, as iterators are
popped off the stack at the start of their final iteration,
making this frequently "incorrect".</div>
</li>
</ul>
<a name="findIterator-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>findIterator</h4>
<pre>protected&nbsp;<a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.ManagedIterator</a>&nbsp;findIterator(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</pre>
<div class="block">Finds the <a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic"><code>LoopTool.ManagedIterator</code></a> with the specified name
if it is in this instance's iterator stack.</div>
</li>
</ul>
<a name="pop--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>pop</h4>
<pre>protected&nbsp;<a href="../../../../../org/apache/velocity/tools/generic/LoopTool.ManagedIterator.html" title="class in org.apache.velocity.tools.generic">LoopTool.ManagedIterator</a>&nbsp;pop()</pre>
<div class="block">Don't let templates call this, but allow subclasses
and ManagedIterator to have access.</div>
</li>
</ul>
<a name="getIterator-java.lang.Object-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getIterator</h4>
<pre>protected&nbsp;<a href="https://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</a>&nbsp;getIterator(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;obj)</pre>
<div class="block">Wraps access to <a href="../../../../../org/apache/velocity/tools/ClassUtils.html#getIterator-java.lang.Object-"><code>ClassUtils.getIterator(java.lang.Object)</code></a> is a
nice little try/catch block to prevent exceptions from
escaping into the template. In the case of such problems,
this will return <code>null</code>.</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/LoopTool.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/velocity/tools/generic/LogTool.html" title="class in org.apache.velocity.tools.generic"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../org/apache/velocity/tools/generic/LoopTool.Action.html" title="enum in org.apache.velocity.tools.generic"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/velocity/tools/generic/LoopTool.html" target="_top">Frames</a></li>
<li><a href="LoopTool.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.org.apache.velocity.tools.generic.SafeConfig">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2002&#x2013;2018 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>