Package net.solarnetwork.central.support
Class CsvFilteredResultsProcessor<R>
java.lang.Object
net.solarnetwork.central.support.AbstractFilteredResultsProcessor<R>
net.solarnetwork.central.support.CsvFilteredResultsProcessor<R>
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,FilteredResultsProcessor<R>
Basic
FilteredResultsProcessor that serializes to CSV.-
Field Summary
FieldsModifier and TypeFieldDescriptionThe default value for thejavaBeanIgnorePropertiesproperty.The default value for thejavaBeanTreatAsStringValuesproperty.static final org.springframework.util.MimeTypeThe text/csv MIME type. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.CsvFilteredResultsProcessor(Writer out, boolean includeHeader) Constructor.CsvFilteredResultsProcessor(Writer out, org.springframework.util.MimeType mimeType, boolean includeHeader, net.solarnetwork.codec.PropertySerializerRegistrar propertySerializerRegistrar) Constructor.CsvFilteredResultsProcessor(Writer out, org.springframework.util.MimeType mimeType, boolean includeHeader, net.solarnetwork.codec.PropertySerializerRegistrar propertySerializerRegistrar, Set<String> javaBeanIgnoreProperties, Set<Class<?>> javaBeanTreatAsStringValues) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()Get the JavaBean properties to ignore.Get the JavaBean classes to treat as strings.org.springframework.util.MimeTypeGet the MIME type generated by this processor.net.solarnetwork.codec.PropertySerializerRegistrarGet the property serializer registrar.voidhandleResultItem(R item) Process a result item.booleanGet the "include header" option.Methods inherited from class net.solarnetwork.central.support.AbstractFilteredResultsProcessor
start
-
Field Details
-
TEXT_CSV_MIME_TYPE
public static final org.springframework.util.MimeType TEXT_CSV_MIME_TYPEThe text/csv MIME type. -
DEFAULT_JAVA_BEAN_IGNORE_PROPERTIES
The default value for thejavaBeanIgnorePropertiesproperty. -
DEFAULT_JAVA_BEAN_STRING_VALUES
The default value for thejavaBeanTreatAsStringValuesproperty.
-
-
Constructor Details
-
CsvFilteredResultsProcessor
Default constructor.The media type will be set to text/csv; the
includeHeaderproperty will be set to true.- Parameters:
out- the output stream to write to
-
CsvFilteredResultsProcessor
Constructor.The media type will be set to text/csv.
- Parameters:
out- the output stream to write toincludeHeader- true to include a header rowNum in the output
-
CsvFilteredResultsProcessor
public CsvFilteredResultsProcessor(Writer out, org.springframework.util.MimeType mimeType, boolean includeHeader, net.solarnetwork.codec.PropertySerializerRegistrar propertySerializerRegistrar) Constructor.The media type will be set to text/csv.
- Parameters:
out- the output stream to write tomimeType- the MIME type to useincludeHeader- true to include a header rowNum in the outputpropertySerializerRegistrar- a registrar to serialize properties with
-
CsvFilteredResultsProcessor
public CsvFilteredResultsProcessor(Writer out, org.springframework.util.MimeType mimeType, boolean includeHeader, net.solarnetwork.codec.PropertySerializerRegistrar propertySerializerRegistrar, Set<String> javaBeanIgnoreProperties, Set<Class<?>> javaBeanTreatAsStringValues) Constructor.- Parameters:
out- the output stream to write tomimeType- the MIME type to useincludeHeader- true to include a header rowNum in the outputpropertySerializerRegistrar- a registrar to serialize properties withjavaBeanIgnoreProperties- a set of JavaBean property names to ignorejavaBeanTreatAsStringValues- a set of JavaBean property names to treat as strings
-
-
Method Details
-
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
-
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
-
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
-
getPropertySerializerRegistrar
public net.solarnetwork.codec.PropertySerializerRegistrar getPropertySerializerRegistrar()Get the property serializer registrar.- Returns:
- the registrar
-
getJavaBeanIgnoreProperties
Get the JavaBean properties to ignore.- Returns:
- the properties
-
getJavaBeanTreatAsStringValues
Get the JavaBean classes to treat as strings.- Returns:
- the class set
-
isIncludeHeader
public boolean isIncludeHeader()Get the "include header" option.- Returns:
- true to include a header rowNum in the output; defaults to true
-