Class DataDrivenTemplateIterator
Throttled implementation of Iterator
, meant to be queried in scenarios when an iterated
context variable is allowed to be in control of the engine's throttling (i.e. the engine's execution
is data-driven).
A common scenario for this would be reactive systems executing the template engine as a part of a flow obtaining data from a data source, so that as the data is obtained, a part of the template is output containing that part of the data.
This class is meant for internal use only from the diverse integrations of Thymeleaf in reactive architectures. There is normally no reason why a user would have to use this class directly.
- Since:
- 3.0.0
- Author:
- Daniel Fernández
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
void
feedBuffer
(List<Object> newElements) void
void
void
boolean
boolean
hasNext()
boolean
next()
void
remove()
void
setSseEventsFirstID
(long sseEventsFirstID) void
setSseEventsPrefix
(String sseEventsPrefix) void
setWriterControl
(IThrottledTemplateWriterControl writerControl) void
void
void
void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
DataDrivenTemplateIterator
public DataDrivenTemplateIterator()
-
-
Method Details
-
setWriterControl
-
setSseEventsPrefix
-
setSseEventsFirstID
public void setSseEventsFirstID(long sseEventsFirstID) -
takeBackLastEventID
public void takeBackLastEventID() -
hasNext
public boolean hasNext() -
next
-
startIteration
public void startIteration() -
finishIteration
public void finishIteration() -
hasBeenQueried
public boolean hasBeenQueried()Returns whether this data driven iterator has been actually queried, i.e., whether its
hasNext()
ornext()
methods have been called at least once.This indicates if the template has actually reached a point at which this iterator has been already needed or not. The typical use of this is to be able to switch between the "head" and the "data/buffer" phase.
- Returns:
true
if this iterator has been queried,false
if not.- Since:
- 3.0.3
-
remove
public void remove() -
continueBufferExecution
public boolean continueBufferExecution() -
feedBuffer
-
startHead
public void startHead() -
feedingComplete
public void feedingComplete() -
startTail
public void startTail() -
finishStep
public void finishStep() -
isStepOutputFinished
public boolean isStepOutputFinished()
-