| org.apache.cocoon.taglib.VarTagSupport org.apache.cocoon.taglib.core.LoopTagSupport
All known Subclasses: org.apache.cocoon.taglib.core.ForEachSupport,
LoopTagSupport | abstract public class LoopTagSupport extends VarTagSupport implements LoopTag,IterationTag(Code) | | Cocoon taglib allows developers to write custom iteration tags by
implementing the LoopTag interface. (This is not to be confused with
org.apache.cocoon.taglib.IterationTag)
LoopTag establishes a mechanism for iteration tags to be recognized
and for type-safe communication with custom subtags.
Since most iteration tags will behave identically with respect to
actual iterative behavior, however, Cocoon taglib provides this
base support class to facilitate implementation. Many iteration tags
will extend this and merely implement the hasNext() and next() methods
to provide contents for the handler to iterate over.
In particular, this base class provides support for:
- iteration control, based on protected next() and hasNext() methods
- subsetting (begin, end, step functionality, including validation
of subset parameters for sensibility)
- item retrieval (getCurrent())
- status retrieval (LoopTagStatus)
- exposing attributes (set by 'var' and 'varStatus' attributes)
In providing support for these tasks, LoopTagSupport contains
certain control variables that act to modify the iteration. Accessors
are provided for these control variables when the variables represent
information needed or wanted at translation time (e.g., var, status). For
other variables, accessors cannot be provided here since subclasses
may differ on their implementations of how those accessors are received.
For instance, one subclass might accept a String and convert it into
an object of a specific type by using an expression evaluator; others
might accept objects directly. Still others might not want to expose
such information to outside control.
Migration from JSTL1.0
See Also: javax.servlet.jsp.jstl.core.LoopTagSupport author: Volker Schmitt version: CVS $Id: LoopTagSupport.java 433543 2006-08-22 06:22:54Z crossley $ |
Field Summary | |
protected int | begin | protected boolean | beginSpecified Boolean flag indicating whether 'begin' was specified. | protected int | count | protected int | end Ending index ('end' attribute). | protected boolean | endSpecified Boolean flag indicating whether 'end' was specified. | protected int | index | protected boolean | last | protected String | statusId | protected int | step | protected boolean | stepSpecified Boolean flag indicating whether 'step' was specified. |
Constructor Summary | |
public | LoopTagSupport() Constructs a new LoopTagSupport. |
begin | protected int begin(Code) | | Starting index ('begin' attribute)
|
beginSpecified | protected boolean beginSpecified(Code) | | Boolean flag indicating whether 'begin' was specified.
|
count | protected int count(Code) | | |
end | protected int end(Code) | | Ending index ('end' attribute). -1 internally indicates 'no end
specified', although accessors for the core JSTL tags do not
allow this value to be supplied directly by the user.
|
endSpecified | protected boolean endSpecified(Code) | | Boolean flag indicating whether 'end' was specified.
|
index | protected int index(Code) | | |
last | protected boolean last(Code) | | |
statusId | protected String statusId(Code) | | Attribute-exposing control
|
step | protected int step(Code) | | Iteration step ('step' attribute)
|
stepSpecified | protected boolean stepSpecified(Code) | | Boolean flag indicating whether 'step' was specified.
|
LoopTagSupport | public LoopTagSupport()(Code) | | Constructs a new LoopTagSupport. As with TagSupport, subclasses
should not provide other constructors and are expected to call
the superclass constructor
|
doFinally | public void doFinally()(Code) | | |
hasNext | abstract protected boolean hasNext() throws SAXException(Code) | | Returns information concerning the availability of more items
over which to iterate. This method must be provided by concrete
subclasses of LoopTagSupport to assist the iterative logic
provided by the supporting base class.
See next for more information about the
purpose and expectations behind this tag.
true if there is at least one more item to iterateover, false otherwise exception: org.xml.sax.SAXException - See Also: LoopTagSupport.next() |
next | abstract protected Object next() throws SAXException(Code) | | Returns the next object over which the tag should iterate. This
method must be provided by concrete subclasses of LoopTagSupport
to inform the base logic about what objects it should iterate over.
It is expected that this method will generally be backed by an
Iterator, but this will not always be the case. In particular, if
retrieving the next object raises the possibility of an exception
being thrown, this method allows that exception to propagate back
to the container as a SAXException; a standalone Iterator
would not be able to do this. (This explains why LoopTagSupport
does not simply call for an Iterator from its subtags.)
the java.lang.Object to use in the next round of iteration exception: org.xml.sax.SAXException - for other, unexpected exceptions |
prepare | abstract protected void prepare() throws SAXException(Code) | | Prepares for a single tag invocation. Specifically, allows
subclasses to prepare for calls to hasNext() and next().
Subclasses can assume that prepare() will be called once for
each invocation of doStartTag() in the superclass.
exception: org.xml.sax.SAXException - |
recycle | public void recycle()(Code) | | |
validateBegin | protected void validateBegin() throws SAXException(Code) | | Ensures the "begin" property is sensible, throwing an exception
expected to propagate up if it isn't
|
validateEnd | protected void validateEnd() throws SAXException(Code) | | Ensures the "end" property is sensible, throwing an exception
expected to propagate up if it isn't
|
validateStep | protected void validateStep() throws SAXException(Code) | | Ensures the "step" property is sensible, throwing an exception
expected to propagate up if it isn't
|
|
|