| Constructor and Description |
|---|
CsvToBean()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
List<CsvException> |
getCapturedExceptions()
Returns the list of all exceptions that would have been thrown during the
import, but were suppressed by setting
throwExceptions to
false. |
Iterator<T> |
iterator()
The iterator returned by this method takes one line of input at a time
and returns one bean at a time.
|
List<T> |
parse()
Parses the input based on parameters already set through other methods.
|
void |
setCsvReader(CSVReader csvReader)
Sets the reader to be used to read in the information from the CSV input.
|
void |
setErrorLocale(Locale errorLocale)
Sets the locale for error messages.
|
void |
setFilter(CsvToBeanFilter filter)
Deprecated.
Please use
CsvToBeanBuilder.withVerifier(BeanVerifier) instead. |
void |
setMappingStrategy(MappingStrategy<? extends T> mappingStrategy)
Sets the mapping strategy to be used by this bean.
|
void |
setOrderedResults(boolean orderedResults)
Sets whether or not results must be returned in the same order in which
they appear in the input.
|
void |
setThrowExceptions(boolean throwExceptions)
Determines whether errors during import should be thrown or kept in a
list for later retrieval via
getCapturedExceptions(). |
void |
setVerifiers(List<BeanVerifier<T>> verifiers)
Sets the list of verifiers to be run on all beans after creation.
|
Stream<T> |
stream()
Parses the input based on parameters already set through other methods.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic List<T> parse() throws IllegalStateException
IllegalStateException - If either MappingStrategy or CSVReader is
not specifiedstream(),
iterator()public Stream<T> stream() throws IllegalStateException
parse() because it avoids the intermediate storage of the
results in a List. If you plan on further processing
the results as a Stream, use this method.IllegalStateException - If either MappingStrategy or CSVReader is
not specifiedparse(),
iterator()public List<CsvException> getCapturedExceptions()
throwExceptions to
false.public void setMappingStrategy(MappingStrategy<? extends T> mappingStrategy)
mappingStrategy - Mapping strategy to convert CSV input to a beanpublic void setCsvReader(CSVReader csvReader)
csvReader - Reader for input@Deprecated public void setFilter(CsvToBeanFilter filter)
CsvToBeanBuilder.withVerifier(BeanVerifier) instead.filter - A class that filters the input linespublic void setThrowExceptions(boolean throwExceptions)
getCapturedExceptions().throwExceptions - Whether or not to throw exceptions during
processingpublic void setOrderedResults(boolean orderedResults)
orderedResults to false. The lack of ordering then also
applies to any captured exceptions, if you have chosen not to have
exceptions thrown.orderedResults - Whether or not the beans returned are in the same
order they appeared in the inputpublic void setErrorLocale(Locale errorLocale)
errorLocale - Locale for error messages. If null, the default locale
is used.public void setVerifiers(List<BeanVerifier<T>> verifiers)
verifiers - A list of verifiers. May be null, in which
case, no verifiers are run.public Iterator<T> iterator()
The advantage to this method is saving memory. The cost is the loss of parallel processing, reducing throughput.
The iterator respects all aspects of CsvToBean, including
filters and capturing exceptions.
Copyright © 2019. All rights reserved.