Interface ExportTemplate
-
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
PlainTextTemplate
,XlsxTemplate
,XMLTemplate
public interface ExportTemplate extends Closeable
A helper interface for theSimpleExport
class to make it easier to output exported data in different formats.- Version:
- 2.2
- Author:
- nicklas
- Last modified
- $Date: 2019-03-12 10:56:19 +0100 (tis, 12 mars 2019) $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
beginDocument()
Start writing the document.void
beginItem(int id)
Start writing a new item.void
endDocument(ProgressReporter progress)
End writing the document.void
endItem()
End writing an itemString
getDefaultFileExtension()
Get the default file extension to give to files generated by this template.String
getMimeType()
Get the MIME type to assign to files generated by this template.void
writeAnnotations(ExportedProperty ep, List<?> values, String unit)
Write annotation values.void
writeCollection(ExportedProperty ep, Collection<?> values)
Write the values in a collectionvoid
writeHeaders()
Write headers.void
writeProperty(ExportedProperty ep, Object data)
Write the specified property values.
-
-
-
Method Detail
-
getMimeType
String getMimeType()
Get the MIME type to assign to files generated by this template.- Returns:
- a String
-
getDefaultFileExtension
String getDefaultFileExtension()
Get the default file extension to give to files generated by this template.- Returns:
- The file extension (without .)
- Since:
- 3.0
-
beginDocument
void beginDocument() throws IOException
Start writing the document.- Throws:
IOException
- If there is an error
-
writeHeaders
void writeHeaders() throws IOException
Write headers.- Throws:
IOException
- If there is an error
-
beginItem
void beginItem(int id) throws IOException
Start writing a new item.- Parameters:
id
- Id of the new item.- Throws:
IOException
- If there is an error
-
writeAnnotations
void writeAnnotations(ExportedProperty ep, List<?> values, String unit) throws IOException
Write annotation values.- Parameters:
ep
- Exported property the annotations belongs tovalues
- Annotation values to be written.unit
- The unit of the annotation values, or null to not display write a unit- Throws:
IOException
- If there is an error
-
writeProperty
void writeProperty(ExportedProperty ep, Object data) throws IOException
Write the specified property values.- Parameters:
ep
- The exported property thedata
belongs to.data
- Data to be written.- Throws:
IOException
- If there is an error
-
writeCollection
void writeCollection(ExportedProperty ep, Collection<?> values) throws IOException
Write the values in a collection- Parameters:
ep
- Exported property the values belong tovalues
- The values to be written- Throws:
IOException
- Since:
- 2.12
-
endItem
void endItem() throws IOException
End writing an item- Throws:
IOException
- If there is an error
-
endDocument
void endDocument(ProgressReporter progress) throws IOException
End writing the document.- Throws:
IOException
- If there is an error
-
-