Package cdc.impex

Class ImpExFactory

java.lang.Object
cdc.impex.ImpExFactory

public class ImpExFactory extends Object
Factory of Importers, StreamExporters 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
  • Constructor Details

  • Method Details

    • getFeatures

      public ImpExFactoryFeatures getFeatures()
    • 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.
    • createStreamExporter

      public StreamExporter createStreamExporter(ImpExFormat format, cdc.issues.IssuesHandler<cdc.issues.Issue> issuesHandler)
      Creates a StreamExporter for a format.
      Parameters:
      format - The format.
      issuesHandler - The issues handler.
      Returns:
      A StreamExporter compliant with format.
      Throws:
      IllegalArgumentException - When format or issuesHandler is null.
    • createStreamExporter

      public StreamExporter createStreamExporter(File file, cdc.issues.IssuesHandler<cdc.issues.Issue> issuesHandler)
      Creates a StreamExporter compliant with a file extension.
      Parameters:
      file - The file.
      issuesHandler - The issues handler.
      Returns:
      A StreamExporter that can export to file or any other compliant file.
      Throws:
      IllegalArgumentException - When file or issuesHandler is null, or file extension is not recognized.
    • createExporter

      public Exporter createExporter(File file)
      Creates an {link Exporter} implementation that is compliant with the format of a file.
      Parameters:
      file - The file.
      Returns:
      An {link Exporter} implementation compliant with format of file.
      Throws:
      IllegalArgumentException - When file is null or its format is not supported.
    • createExporter

      public Exporter createExporter(ImpExFormat format)
      Creates an {link Exporter} implementation that is compliant with a format.
      Parameters:
      format - The format.
      Returns:
      An {link Exporter} implementation compliant with format.
      Throws:
      IllegalArgumentException - When format is null.
    • createActiveExporter

      public ActiveExporter createActiveExporter(File file)
      Creates an {link ActiveExporter} implementation that is compliant with the format of a file.
      Parameters:
      file - The file.
      Returns:
      An {link ActiveExporter} implementation compliant with format of file.
      Throws:
      IllegalArgumentException - When file is null or its format is not supported.
    • createActiveExporter

      public ActiveExporter createActiveExporter(ImpExFormat format)
      Creates an {link ActiveExporter} implementation that is compliant with a format.
      Parameters:
      format - The format.
      Returns:
      An {link ActiveExporter} implementation compliant with format.
      Throws:
      IllegalArgumentException - When format is null.
    • 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.
    • createImportAnalyzer

      public ImportAnalyzer createImportAnalyzer(File file)