Witam, piszę klasę która ma czytać plik CSV z dysku i parsować jego kolumny to tablicy Stringów. Z czterech potrzebnych medtod udało mi się napisać jedną, brakuję mi metod setInvoicesTypes, setIssueDate, setDueDate. Proszę o podsunięcie jakiegoś pomysłu na rozwiązanie.
@Component
@Qualifier("csvBFPReader")
public class CSVBatchFacturationParamsReader implements BatchFacturationParamsReader, CSVReader<BatchFacturationParameters> {
@SuppressWarnings("null")
public List<BatchFacturationParameters> read(InputStream is) throws FileUploadException {
try {
List<BatchFacturationParameters> result = new ArrayList<BatchFacturationParameters>();
BufferedReader reader = new BufferedReader(new FileReader("c:/programy/partial1.csv"), '|');
String[] nextLine;
BatchFacturationParameters b = new BatchFacturationParameters();
while ((nextLine = reader.readNext()) != null) {
if (nextLine != null) {
b.setInvoicesTypes(invoicesTypes);
b.setIssueDate(issueDate);
b.setDueDate();
if (nextLine[0] != null && !nextLine[0].isEmpty()) {
b.setSubject(new Subject(nextLine[0], Type.CLIENT));
} else {
b.setSubject(new Subject(nextLine[1], Type.CONTRACT));
}
System.out.println(Arrays.toString(nextLine));
result.add(b);
}
}
} catch (FileNotFoundException ex) {
java.util.logging.Logger.getLogger(CSVBatchFacturationParamsReader.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
}