Interface ExportTemplate

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
PlainTextTemplate, XlsxTemplate, XMLTemplate

public interface ExportTemplate
extends Closeable
A helper interface for the SimpleExport 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 Details

    • 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 to
      values - 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 the data 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 to
      values - 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