@Override public Iterator<T> iterator() { return iterator(this); }
/** * Creates the IterableCSVToBean. * * Will throw a runtime exception if the MappingStrategy or CSVReader is not set. * * @return An instance of IterableCSVToBean */ public IterableCSVToBean<T> build() { if (mapper == null) { throw new RuntimeException(ResourceBundle.getBundle(ICSVParser.DEFAULT_BUNDLE_NAME, errorLocale).getString("strategy.undefined")); } if (csvReader == null) { throw new RuntimeException(ResourceBundle.getBundle(ICSVParser.DEFAULT_BUNDLE_NAME, errorLocale).getString("csvreader.null")); } IterableCSVToBean<T> result = new IterableCSVToBean<>(csvReader, mapper, filter); result.setErrorLocale(errorLocale); return result; }
@Override public boolean hasNext() { if (nextBean != null) { return true; } try { nextBean = bean.nextLine(); } catch (IllegalAccessException | InstantiationException | IOException | IntrospectionException | InvocationTargetException | CsvRequiredFieldEmptyException e) { e.printStackTrace(); } return nextBean != null; }