@Test public void testWitClassContainingNonPrimitiveFields() { List<ClassWithNonPrimitiveFields> objects = FlexibleCsvReader.readAll( validCsvForClassContainingNonPrimitiveFields, ClassWithNonPrimitiveFields.class, true, false, false, false, ";", "NA"); assertEquals(Arrays.asList( new ClassWithNonPrimitiveFields(null, "hello", 0.5, true, 0L), new ClassWithNonPrimitiveFields(null, "", -0.5, true, -1L), new ClassWithNonPrimitiveFields(3, "NA", 0.0, true, 9223372036854775807L), new ClassWithNonPrimitiveFields(0, "hello", null, false, 0L), new ClassWithNonPrimitiveFields(0, "hello", 0.0, false, 0L), new ClassWithNonPrimitiveFields(0, "hello", 0.0, false, 0L)), objects); assertEquals(1, (int)ClassWithNonPrimitiveFields.staticField1); assertEquals(2, ClassWithNonPrimitiveFields.staticField2); TestUtils.verifyThrow(FlexibleCsvReader.InvalidContent.class, ()->FlexibleCsvReader.readAll( getCsv("ClassWithNonPrimitiveFields/invalid_boolean.csv"), ClassWithNonPrimitiveFields.class, true, false, false, false, ";", "NA")); TestUtils.verifyThrow(FlexibleCsvReader.InvalidContent.class, ()->FlexibleCsvReader.readAll( getCsv("ClassWithNonPrimitiveFields/invalid_integer.csv"), ClassWithNonPrimitiveFields.class, true, false, false, false, ";", "NA")); }
public List<T> readAll() { List<T> result = new LinkedList<>(); T obj; while ((obj = parseNextRow()) != null) result.add(obj); return result; }
FlexibleCsvReader implements Closeable { public List<T> readAll() { List<T> result = new LinkedList<>(); T obj; while ((obj = parseNextRow()) != null) result.add(obj); return result; } }
FlexibleCsvReader implements Closeable { public List<T> readAll() { List<T> result = new LinkedList<>(); T obj; while ((obj = parseNextRow()) != null) result.add(obj); return result; } FlexibleCsvReader(Path csv, boolean useExcelFormat, Class<T> rowObjectClass,
                             boolean ignoreUnmatchedColumnTitles, boolean ignoreUnmatchedFields,
                             boolean skipEmptyRows);  FlexibleCsvReader(Path csv, Class<T> rowObjectClass, boolean useExcelFormat, boolean ignoreUnmatchedColumnTitles,
                             boolean ignoreUnmatchedFields, String separator, boolean skipEmptyRows,
                             @Nullable String stringRepresentingNull); }
FlexibleCsvReader implements Closeable { public List<T> readAll() { List<T> result = new LinkedList<>(); T obj; while ((obj = parseNextRow()) != null) result.add(obj); return result; } FlexibleCsvReader(Path csv, boolean useExcelFormat, Class<T> rowObjectClass,
                             boolean ignoreUnmatchedColumnTitles, boolean ignoreUnmatchedFields,
                             boolean skipEmptyRows);  FlexibleCsvReader(Path csv, Class<T> rowObjectClass, boolean useExcelFormat, boolean ignoreUnmatchedColumnTitles,
                             boolean ignoreUnmatchedFields, String separator, boolean skipEmptyRows,
                             @Nullable String stringRepresentingNull); @Nullable T parseNextRow(); List<T> readAll(); @Override void close(); static List<T> readAll(Path csv, Class<T> rowObjectClass,
                                      boolean useExcelFormat, boolean ignoreUnmatchedColumnTitles,
                                      boolean ignoreUnmatchedFields, boolean skipEmptyRows); static List<T> readAll(Path csv, Class<T> rowObjectClass, boolean useExcelFormat, boolean ignoreUnmatchedColumnTitles,
                                      boolean ignoreUnmatchedFields, boolean skipEmptyRows, String separator,
                                      @Nullable String stringRepresentingNull); }
FlexibleCsvReader implements Closeable { public List<T> readAll() { List<T> result = new LinkedList<>(); T obj; while ((obj = parseNextRow()) != null) result.add(obj); return result; } FlexibleCsvReader(Path csv, boolean useExcelFormat, Class<T> rowObjectClass,
                             boolean ignoreUnmatchedColumnTitles, boolean ignoreUnmatchedFields,
                             boolean skipEmptyRows);  FlexibleCsvReader(Path csv, Class<T> rowObjectClass, boolean useExcelFormat, boolean ignoreUnmatchedColumnTitles,
                             boolean ignoreUnmatchedFields, String separator, boolean skipEmptyRows,
                             @Nullable String stringRepresentingNull); @Nullable T parseNextRow(); List<T> readAll(); @Override void close(); static List<T> readAll(Path csv, Class<T> rowObjectClass,
                                      boolean useExcelFormat, boolean ignoreUnmatchedColumnTitles,
                                      boolean ignoreUnmatchedFields, boolean skipEmptyRows); static List<T> readAll(Path csv, Class<T> rowObjectClass, boolean useExcelFormat, boolean ignoreUnmatchedColumnTitles,
                                      boolean ignoreUnmatchedFields, boolean skipEmptyRows, String separator,
                                      @Nullable String stringRepresentingNull);  }