Package cdc.impex.api

Interface Exporter


  • public interface Exporter
    Interface implemented by classes that can be used to export data.

    This should be used like this:

     beginExport(file);
     foreach (sheet):
        beginSheet(sheet.template);
        foreach (row):
           beginRow();
           foreach(column):
              setData(column, data);
           endRow();
        endSheet();
     endExport();
     
    Author:
    Damien Carbonne
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void beginExport​(File file)
      Must be invoked at beginning of export.
      void beginRow()
      Must be invoked at beginning of writing a new data row.
      void beginSheet​(SheetTemplate template)
      Must be invoked at the beginning of a sheet export.
      void endExport()
      Must be invoked at end of export.
      void endRow()
      Must be invoked at the end of writing a data row.
      void endSheet()
      Must be invoked at the end of writing a sheet.
      <T> void setData​(ColumnTemplate<T> column, T data)
      Invoked to set the content of a column in current row.
      void setData​(String name, Object data)
      Invoked to set the content of a column in current row.
    • Method Detail

      • beginExport

        void beginExport​(File file)
                  throws IOException
        Must be invoked at beginning of export.
        Parameters:
        file - The target file.
        Throws:
        IOException - When a IO error occurs.
      • beginSheet

        void beginSheet​(SheetTemplate template)
                 throws IOException
        Must be invoked at the beginning of a sheet export.

        Using several times the same template in a workbook must be supported.

        Parameters:
        template - The template used for that sheet.
        Throws:
        IOException - When a IO error occurs.
      • beginRow

        void beginRow()
               throws IOException
        Must be invoked at beginning of writing a new data row.
        Throws:
        IOException - When a IO error occurs.
      • setData

        void setData​(String name,
                     Object data)
              throws IOException
        Invoked to set the content of a column in current row.
        Parameters:
        name - The column name.
        data - The data to write.
        Throws:
        IOException - When a IO error occurs.
      • setData

        <T> void setData​(ColumnTemplate<T> column,
                         T data)
                  throws IOException
        Invoked to set the content of a column in current row.
        Type Parameters:
        T - The column data type
        Parameters:
        column - The column.
        data - The data to write.
        Throws:
        IOException - When a IO error occurs.
      • endRow

        void endRow()
             throws IOException
        Must be invoked at the end of writing a data row.
        Throws:
        IOException - When a IO error occurs.
      • endSheet

        void endSheet()
               throws IOException
        Must be invoked at the end of writing a sheet.
        Throws:
        IOException - When a IO error occurs.
      • endExport

        void endExport()
                throws IOException
        Must be invoked at end of export.
        Throws:
        IOException - When a IO error occurs.