Class AbstractBufferingProcessor
- java.lang.Object
-
- io.wcm.caravan.io.jsontransform.processor.AbstractBufferingProcessor
-
- All Implemented Interfaces:
Processor
,Source
,Closeable
,AutoCloseable
,Iterator<JsonElement>
- Direct Known Subclasses:
AbstractPathProcessor
@ConsumerType public abstract class AbstractBufferingProcessor extends Object implements Processor
Helping abstract processor with an output buffer to process multiple incoming JSON stream elements.
-
-
Field Summary
Fields Modifier and Type Field Description protected Queue<JsonElement>
outputBuffer
protected Source
source
-
Constructor Summary
Constructors Constructor Description AbstractBufferingProcessor(Source source)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
hasNext()
JsonElement
next()
protected abstract void
process(JsonElement element)
Has to process the incoming JSON stream element.-
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, remove
-
-
-
-
Field Detail
-
source
protected final Source source
-
outputBuffer
protected final Queue<JsonElement> outputBuffer
-
-
Constructor Detail
-
AbstractBufferingProcessor
public AbstractBufferingProcessor(Source source)
- Parameters:
source
- The source to get JSON stream elements from
-
-
Method Detail
-
process
protected abstract void process(JsonElement element)
Has to process the incoming JSON stream element.- Parameters:
element
- Current JSON element
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfaceIterator<JsonElement>
-
next
public JsonElement next()
- Specified by:
next
in interfaceIterator<JsonElement>
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-