This interface will be implemented by PDFLoader, SampleLoader and JSONLoader structures
Define persistent layer. Extract interface PersistenWriter with function Write.
This interface will be implemented by FileWriter, ElasticSearchWriter and CSVWriter structures.
Every structure implements logic for saving object in function Write
Extract interface Service with function Save
Interface will be implemented by StorageService. Save function will choose from existing PersistenWriter implementation and use the appropriate implementation.
JSONLoader will contain Service interface as a structure fields
Main function will choose appropriate Loader implementation depends on provided mod in arguments.
Loader
withLoad
functionPDFLoader
,SampleLoader
andJSONLoader
structuresPersistenWriter
with functionWrite
.FileWriter
,ElasticSearchWriter
andCSVWriter
structures.Write
Service
with functionSave
StorageService
.Save
function will choose from existingPersistenWriter
implementation and use the appropriate implementation.JSONLoader
will containService
interface as a structure fieldsLoader
implementation depends on provided mod in arguments.Approximate code structure: