Package cdc.impex.api

Class ImpExFactory


  • public class ImpExFactory
    extends Object
    Factory of Importers, ExportDrivers and TemplateGenerators.

    Note:At the moment, CSV, XLS, XSLX, XLSM and ODS workbooks are supported. In the future, some other formats (such as XML or JSON) may/will be supported.

    Author:
    Damien Carbonne
    • Method Detail

      • canImportFrom

        public boolean canImportFrom​(File file)
        Parameters:
        file - The file
        Returns:
        true if file can be imported.
        WARNING: file extension is checked.
      • createImporter

        public Importer createImporter​(File file)
        Creates an Importer for a file.
        Parameters:
        file - The file.
        Returns:
        An Importer that can import from file or any compliant file.
        Throws:
        IllegalArgumentException - When file is null or extension is not recognized.
      • canExportTo

        public boolean canExportTo​(File file)
        Parameters:
        file - The file
        Returns:
        true if data cab be exported to file.
        WARNING: file extension is checked.
      • createExportDriver

        public ExportDriver createExportDriver​(File file,
                                               cdc.issues.api.IssuesHandler<? super ExportIssue> issuesHandler)
        Creates an ExportDriver for a file.
        Parameters:
        file - The file.
        issuesHandler - The issues handler.
        Returns:
        An ExportDriver that can export to file or any compliant file.
        Throws:
        IllegalArgumentException - When file is null or extension is not recognized.
      • createExporter

        public Exporter createExporter​(File file)
      • createTemplateGenerator

        public TemplateGenerator createTemplateGenerator​(File file)
        Creates a TemplateGenarator for a file.
        Parameters:
        file - The file.
        Returns:
        A TemplateGenrator that matches file. It can be used with any compliant file.
        Throws:
        IllegalArgumentException - When file is null or extension is not recognized.