package uk.ac.ebi.atlas.experimentimport.coexpression;

import uk.ac.ebi.atlas.utils.CsvReaderFactory;
import au.com.bytecode.opencsv.CSVReader;
import org.springframework.beans.factory.annotation.Value;

import javax.inject.Inject;
import javax.inject.Named;
import java.nio.file.NoSuchFileException;
import java.text.MessageFormat;

@Named
public class BaselineCoexpressionProfileInputStreamFactory {

    private final CsvReaderFactory csvReaderFactory;
    private final String fileTemplate;

    @Inject
    public BaselineCoexpressionProfileInputStreamFactory(@Value("#{configuration['experiment.coexpression_matrix.template']}") String fileTemplate,
                                                         CsvReaderFactory csvReaderFactory) {
        this.fileTemplate = fileTemplate;
        this.csvReaderFactory = csvReaderFactory;
    }

    public BaselineCoexpressionProfileInputStream create(String experimentAccession) throws NoSuchFileException {
        String tsvGzFilePath = MessageFormat.format(fileTemplate, experimentAccession);
        CSVReader csvReader = csvReaderFactory.createTsvGzReader(tsvGzFilePath);
        return new BaselineCoexpressionProfileInputStream(csvReader, tsvGzFilePath);
    }
}

@@ -401,61 +401,8 @@
  %7B%0A%0A
-    private final CsvReaderFactory csvReaderFactory;%0A
     
@@ -599,194 +599,52 @@
 late
-,%0A                                                         CsvReaderFactory csvReaderFactory) %7B%0A        this.fileTemplate = fileTemplate;%0A        this.csvReaderFactory = csvReaderFactory
+) %7B%0A        this.fileTemplate = fileTemplate
 ;%0A  
@@ -880,17 +880,17 @@
 eader = 
-c
+C
 svReader
@@ -907,19 +907,16 @@
 eate
+For
 TsvGz
-Reader
 (tsv

Make CsvReaderFactory a POJO with static methods