Package net.solarnetwork.central.support
Class ObjectMapperFilteredResultsProcessor<R>
java.lang.Object
net.solarnetwork.central.support.AbstractFilteredResultsProcessor<R>
net.solarnetwork.central.support.ObjectMapperFilteredResultsProcessor<R>
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,FilteredResultsProcessor<R>
Basic
FilteredResultsProcessor that serializes using Jackson JSON.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.fasterxml.jackson.core.io.SerializedStringThe success array field name. -
Constructor Summary
ConstructorsConstructorDescriptionObjectMapperFilteredResultsProcessor(com.fasterxml.jackson.core.JsonGenerator generator, com.fasterxml.jackson.databind.SerializerProvider provider, org.springframework.util.MimeType mimeType, com.fasterxml.jackson.databind.JsonSerializer<R> serializer) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()org.springframework.util.MimeTypeGet the MIME type generated by this processor.voidhandleResultItem(R item) Process a result item.voidstart(Long totalResultCount, Integer startingOffset, Integer expectedResultCount, Map<String, ?> attributes) Called at the start of the export process, to initialize any necessary resources or write any header information.
-
Field Details
-
SUCCESS_FIELD_NAME
public static final com.fasterxml.jackson.core.io.SerializedString SUCCESS_FIELD_NAMEThe success array field name.
-
-
Constructor Details
-
ObjectMapperFilteredResultsProcessor
public ObjectMapperFilteredResultsProcessor(com.fasterxml.jackson.core.JsonGenerator generator, com.fasterxml.jackson.databind.SerializerProvider provider, org.springframework.util.MimeType mimeType, com.fasterxml.jackson.databind.JsonSerializer<R> serializer) Constructor.- Parameters:
generator- the generator to useprovider- the provider to usethe- serializer to use, or null to rely on theJsonGenerator- Throws:
IllegalArgumentException- if any argument other thanserializeris null
-
-
Method Details
-
getMimeType
public org.springframework.util.MimeType getMimeType()Description copied from interface:FilteredResultsProcessorGet the MIME type generated by this processor.- Specified by:
getMimeTypein interfaceFilteredResultsProcessor<R>- Overrides:
getMimeTypein classAbstractFilteredResultsProcessor<R>- Returns:
- the media type
-
start
public void start(Long totalResultCount, Integer startingOffset, Integer expectedResultCount, Map<String, ?> attributes) throws IOExceptionDescription copied from interface:FilteredResultsProcessorCalled at the start of the export process, to initialize any necessary resources or write any header information.- Specified by:
startin interfaceFilteredResultsProcessor<R>- Overrides:
startin classAbstractFilteredResultsProcessor<R>- Parameters:
totalResultCount- the total number of results that match the given query, or null if the count is not knownstartingOffset- a starting offset within the total result count, or null if not knownexpectedResultCount- the expected number of results to be returned toFilteredResultsProcessor.handleResultItem(Object)attributes- optional implementation-specific attributes to pass to the processor- Throws:
IOException- if an IO error occurs
-
handleResultItem
Description copied from interface:FilteredResultsProcessorProcess a result item.This method should only be called after
has been called.invalid reference
#start(Long, Integer, Integer)- Parameters:
item- the result item to process- Throws:
IOException- if an IO error occurs
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classAbstractFilteredResultsProcessor<R>- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classAbstractFilteredResultsProcessor<R>- Throws:
IOException
-