Package cdc.impex
Class ImpExFactory
- java.lang.Object
-
- cdc.impex.ImpExFactory
-
public class ImpExFactory extends Object
Factory ofImporters,StreamExporters andTemplateGenerators.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 Summary
Constructors Constructor Description ImpExFactory(ImpExFactoryFeatures features)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanExportTo(File file)booleancanImportFrom(File file)ActiveExportercreateActiveExporter(ImpExFormat format)Creates an {link ActiveExporter} implementation that is compliant with a format.ActiveExportercreateActiveExporter(File file)Creates an {link ActiveExporter} implementation that is compliant with the format of a file.ExportercreateExporter(ImpExFormat format)Creates an {link Exporter} implementation that is compliant with a format.ExportercreateExporter(File file)Creates an {link Exporter} implementation that is compliant with the format of a file.ImportAnalyzercreateImportAnalyzer(File file)ImportercreateImporter(File file)Creates an Importer for a file.StreamExportercreateStreamExporter(ImpExFormat format, cdc.issues.IssuesHandler<cdc.issues.Issue> issuesHandler)Creates aStreamExporterfor a format.StreamExportercreateStreamExporter(File file, cdc.issues.IssuesHandler<cdc.issues.Issue> issuesHandler)Creates aStreamExportercompliant with a file extension.TemplateGeneratorcreateTemplateGenerator(File file)Creates a TemplateGenarator for a file.ImpExFactoryFeaturesgetFeatures()
-
-
-
Constructor Detail
-
ImpExFactory
public ImpExFactory(ImpExFactoryFeatures features)
-
-
Method Detail
-
getFeatures
public ImpExFactoryFeatures getFeatures()
-
canImportFrom
public boolean canImportFrom(File file)
- Parameters:
file- The file- Returns:
trueiffilecan be imported.
WARNING:fileextension 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
fileor any compliant file. - Throws:
IllegalArgumentException- Whenfileisnullor extension is not recognized.
-
canExportTo
public boolean canExportTo(File file)
- Parameters:
file- The file- Returns:
trueif data cab be exported tofile.
WARNING:fileextension is checked.
-
createStreamExporter
public StreamExporter createStreamExporter(ImpExFormat format, cdc.issues.IssuesHandler<cdc.issues.Issue> issuesHandler)
Creates aStreamExporterfor a format.- Parameters:
format- The format.issuesHandler- The issues handler.- Returns:
- A
StreamExportercompliant withformat. - Throws:
IllegalArgumentException- WhenformatorissuesHandlerisnull.
-
createStreamExporter
public StreamExporter createStreamExporter(File file, cdc.issues.IssuesHandler<cdc.issues.Issue> issuesHandler)
Creates aStreamExportercompliant with a file extension.- Parameters:
file- The file.issuesHandler- The issues handler.- Returns:
- A
StreamExporterthat can export tofileor any other compliant file. - Throws:
IllegalArgumentException- WhenfileorissuesHandlerisnull, 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- Whenfileisnullor 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- Whenformatisnull.
-
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- Whenfileisnullor 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- Whenformatisnull.
-
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- Whenfileisnullor extension is not recognized.
-
createImportAnalyzer
public ImportAnalyzer createImportAnalyzer(File file)
-
-