T
- The type of the beans being writtenpublic class StatefulBeanToCsvBuilder<T> extends Object
Constructor and Description |
---|
StatefulBeanToCsvBuilder(Writer writer)
Default constructor - Being stateful the writer is required by the builder at the start and not added in later.
|
Modifier and Type | Method and Description |
---|---|
StatefulBeanToCsv |
build()
Builds a StatefulBeanToCsv from the information provided, filling in
default values where none have been specified.
|
StatefulBeanToCsvBuilder |
withEscapechar(char escapechar) |
StatefulBeanToCsvBuilder |
withLineEnd(String lineEnd) |
StatefulBeanToCsvBuilder |
withMappingStrategy(MappingStrategy<T> mappingStrategy)
Sets the mapping strategy for writing beans to a CSV destination.
|
StatefulBeanToCsvBuilder |
withQuotechar(char quotechar) |
StatefulBeanToCsvBuilder |
withSeparator(char separator) |
StatefulBeanToCsvBuilder |
withThrowExceptions(boolean throwExceptions) |
public StatefulBeanToCsvBuilder(Writer writer)
writer
- - the writer that will be used to output the csv version of the bean.public StatefulBeanToCsvBuilder withMappingStrategy(MappingStrategy<T> mappingStrategy)
If the mapping strategy is set this way, it will always be used instead of automatic determination of an appropriate mapping strategy.
It is perfectly legitimate to read a CSV source, take the mapping strategy from the read operation, and pass it in to this method for a write operation. This conserves some processing time, but, more importantly, preserves header ordering.
mappingStrategy
- The mapping strategy to be used for write operationspublic StatefulBeanToCsvBuilder withSeparator(char separator)
separator
- The field separator to be used when writing a CSV fileCSVWriter.separator
public StatefulBeanToCsvBuilder withQuotechar(char quotechar)
quotechar
- The quote character to be used when writing a CSV fileCSVWriter.quotechar
public StatefulBeanToCsvBuilder withEscapechar(char escapechar)
escapechar
- The escape character to be used when writing a CSV fileCSVWriter.escapechar
public StatefulBeanToCsvBuilder withLineEnd(String lineEnd)
lineEnd
- The line ending to be used when writing a CSV fileCSVWriter.lineEnd
public StatefulBeanToCsvBuilder withThrowExceptions(boolean throwExceptions)
throwExceptions
- Whether or not exceptions should be thrown while
writing a CSV file. If not, they may be retrieved later by calling
StatefulBeanToCsv.getCapturedExceptions()
.public StatefulBeanToCsv build()
StatefulBeanToCsv
Copyright © 2017. All rights reserved.