Class StreamingJsonArrayFileReader<T>
java.lang.Object
com.broadleafcommerce.datafeed.service.publisher.file.support.StreamingJsonArrayFileReader<T>
- Type Parameters:
- T- the POJO type to deserialize each array element into
Useful for reading through a file which is just a JSON array of objects (ex: typically what is in
 
DataFeedProcessExecution.getQueriedDataFileLocation() when using
 AbstractJsonArrayDataFeedCollector). This utility allows consumers to read elements from
 such a file in a streaming fashion (to avoid loading everything into memory at once).
 This is not intended to be a bean, and is expected to be manually instantiated and used to process a specific file.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionThe POJO type to deserialize each element into.A callback that will do work on a batch of read elements.protected PathThe JSON array file to process.protected intThe number of elements to load into memory and transform at a time.protected com.fasterxml.jackson.databind.ObjectMapperTheObjectMapperto use for deserialization.voidread()
- 
Constructor Details- 
StreamingJsonArrayFileReader
 
- 
- 
Method Details- 
read- Throws:
- IOException- if something went wrong
 
- 
getObjectMapperprotected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()TheObjectMapperto use for deserialization.
- 
getDeserializedElementTypeThe POJO type to deserialize each element into.
- 
getMaxElementsToReadInBatchprotected int getMaxElementsToReadInBatch()The number of elements to load into memory and transform at a time.
- 
getElementBatchHandlerA callback that will do work on a batch of read elements.
- 
getFileToProcessThe JSON array file to process.
 
-