@Dataformat(value="csv")
public class CsvDataFormat
extends org.apache.camel.support.service.ServiceSupport
implements org.apache.camel.spi.DataFormat, org.apache.camel.spi.DataFormatName
| Constructor and Description |
|---|
CsvDataFormat() |
CsvDataFormat(org.apache.commons.csv.CSVFormat format) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doStart() |
protected void |
doStop() |
Boolean |
getAllowMissingColumnNames()
Indicates whether or not missing column names are allowed.
|
Character |
getCommentMarker()
Gets the comment marker.
|
String |
getDataFormatName() |
Character |
getDelimiter()
Gets the delimiter.
|
Character |
getEscape()
Gets the escape character.
|
org.apache.commons.csv.CSVFormat |
getFormat()
Gets the CSV format before applying any changes.
|
String[] |
getHeader()
Gets the header.
|
Boolean |
getIgnoreEmptyLines()
Indicates whether or not empty lines must be ignored.
|
Boolean |
getIgnoreHeaderCase()
Indicates whether or not to ignore case when accessing header names.
|
Boolean |
getIgnoreSurroundingSpaces()
Indicates whether or not surrounding spaces must be ignored.
|
CsvMarshallerFactory |
getMarshallerFactory()
Returns the used
CsvMarshallerFactory. |
String |
getNullString()
Gets the null string replacement.
|
Character |
getQuote()
Gets the quote character.
|
org.apache.commons.csv.QuoteMode |
getQuoteMode()
Gets the quote mode.
|
CsvRecordConverter<?> |
getRecordConverter()
Gets the record converter to use.
|
String |
getRecordSeparator()
Gets the record separator.
|
Boolean |
getSkipHeaderRecord()
Indicates whether or not header record must be skipped.
|
Boolean |
getTrailingDelimiter()
Indicates whether or not to add a trailing delimiter.
|
Boolean |
getTrim()
Indicates whether or not to trim leading and trailing blanks.
|
boolean |
isCommentMarkerDisabled()
Indicates whether or not the comment markers are disabled.
|
boolean |
isEscapeDisabled()
Indicates whether or not the escaping is disabled.
|
boolean |
isHeaderDisabled()
Indicates whether or not the headers are disabled.
|
boolean |
isLazyLoad()
Indicates whether or not the unmarshalling should lazily load the records.
|
boolean |
isNullStringDisabled()
Indicates whether or not the null string replacement is disabled.
|
boolean |
isQuoteDisabled()
Indicates whether or not quotes are disabled.
|
boolean |
isRecordSeparatorDisabled()
Indicates whether or not the record separator is disabled.
|
boolean |
isUseMaps()
Indicates whether or not the unmarshalling should produce maps instead of lists.
|
boolean |
isUseOrderedMaps()
Indicates whether or not the unmarshalling should produce ordered maps instead of lists.
|
void |
marshal(org.apache.camel.Exchange exchange,
Object object,
OutputStream outputStream) |
CsvDataFormat |
setAllowMissingColumnNames(Boolean allowMissingColumnNames)
Sets whether or not missing column names are allowed.
|
CsvDataFormat |
setCommentMarker(Character commentMarker)
Sets the comment marker to use.
|
CsvDataFormat |
setCommentMarkerDisabled(boolean commentMarkerDisabled)
Sets whether or not the comment markers are disabled.
|
CsvDataFormat |
setDelimiter(Character delimiter)
Sets the delimiter.
|
CsvDataFormat |
setEscape(Character escape)
Sets the escape character.
|
CsvDataFormat |
setEscapeDisabled(boolean escapeDisabled)
Sets whether or not the escaping is disabled.
|
CsvDataFormat |
setFormat(org.apache.commons.csv.CSVFormat format)
Sets the CSV format before applying any changes.
|
CsvDataFormat |
setFormatName(String name)
Sets the CSV format by name before applying any changes.
|
CsvDataFormat |
setHeader(String[] header)
Gets the header.
|
CsvDataFormat |
setHeaderDisabled(boolean headerDisabled)
Sets whether or not the headers are disabled.
|
CsvDataFormat |
setIgnoreEmptyLines(Boolean ignoreEmptyLines)
Sets whether or not empty lines must be ignored.
|
CsvDataFormat |
setIgnoreHeaderCase(Boolean ignoreHeaderCase)
Sets whether or not to ignore case when accessing header names.
|
CsvDataFormat |
setIgnoreSurroundingSpaces(Boolean ignoreSurroundingSpaces)
Sets whether or not surrounding spaces must be ignored.
|
CsvDataFormat |
setLazyLoad(boolean lazyLoad)
Indicates whether or not the unmarshalling should lazily load the records.
|
CsvDataFormat |
setMarshallerFactory(CsvMarshallerFactory marshallerFactory)
Sets the
CsvMarshaller factory. |
CsvDataFormat |
setNullString(String nullString)
Sets the null string replacement.
|
CsvDataFormat |
setNullStringDisabled(boolean nullStringDisabled)
Sets whether or not the null string replacement is disabled.
|
CsvDataFormat |
setQuote(Character quote)
Sets the quote character.
|
CsvDataFormat |
setQuoteDisabled(boolean quoteDisabled)
Sets whether or not quotes are disabled
|
CsvDataFormat |
setQuoteMode(org.apache.commons.csv.QuoteMode quoteMode)
Sets the quote mode.
|
CsvDataFormat |
setRecordConverter(CsvRecordConverter<?> recordConverter)
Sets the record converter to use.
|
CsvDataFormat |
setRecordSeparator(String recordSeparator)
Sets the record separator.
|
CsvDataFormat |
setRecordSeparatorDisabled(boolean recordSeparatorDisabled)
Sets whether or not the record separator is disabled.
|
CsvDataFormat |
setSkipHeaderRecord(Boolean skipHeaderRecord)
Sets whether or not header record must be skipped.
|
CsvDataFormat |
setTrailingDelimiter(Boolean trailingDelimiter)
Sets whether or not to add a trailing delimiter.
|
CsvDataFormat |
setTrim(Boolean trim)
Sets whether or not to trim leading and trailing blanks.
|
CsvDataFormat |
setUseMaps(boolean useMaps)
Sets whether or not the unmarshalling should produce maps instead of lists.
|
CsvDataFormat |
setUseOrderedMaps(boolean useOrderedMaps)
Sets whether or not the unmarshalling should produce ordered maps instead of lists.
|
Object |
unmarshal(org.apache.camel.Exchange exchange,
InputStream inputStream) |
build, doBuild, doInit, doResume, doShutdown, doSuspend, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendpublic CsvDataFormat()
public CsvDataFormat(org.apache.commons.csv.CSVFormat format)
public String getDataFormatName()
getDataFormatName in interface org.apache.camel.spi.DataFormatNamepublic void marshal(org.apache.camel.Exchange exchange,
Object object,
OutputStream outputStream)
throws Exception
marshal in interface org.apache.camel.spi.DataFormatExceptionpublic Object unmarshal(org.apache.camel.Exchange exchange, InputStream inputStream) throws Exception
unmarshal in interface org.apache.camel.spi.DataFormatExceptionprotected void doStart()
throws Exception
doStart in class org.apache.camel.support.service.ServiceSupportExceptionprotected void doStop()
throws Exception
doStop in class org.apache.camel.support.service.ServiceSupportExceptionpublic org.apache.commons.csv.CSVFormat getFormat()
null, the default one is CSVFormat.DEFAULT.public CsvDataFormat setFormat(org.apache.commons.csv.CSVFormat format)
null, then CSVFormat.DEFAULT is used instead.format - CSV formatCsvDataFormat, fluent APICSVFormat,
CSVFormat.DEFAULTpublic CsvDataFormat setMarshallerFactory(CsvMarshallerFactory marshallerFactory)
marshallerFactory - CsvDataFormat, fluent APIpublic CsvMarshallerFactory getMarshallerFactory()
CsvMarshallerFactory.null.public CsvDataFormat setFormatName(String name)
name - CSV format nameCsvDataFormat, fluent APIsetFormat(org.apache.commons.csv.CSVFormat),
CSVFormatpublic boolean isCommentMarkerDisabled()
true if the comment markers are disabled, false otherwisepublic CsvDataFormat setCommentMarkerDisabled(boolean commentMarkerDisabled)
commentMarkerDisabled - true if the comment markers are disabled, false otherwiseCsvDataFormat, fluent APICSVFormat.withCommentMarker(java.lang.Character)public Character getCommentMarker()
null then the default one of the format used.public CsvDataFormat setCommentMarker(Character commentMarker)
null then the default one of the format used.commentMarker - Comment markerCsvDataFormat, fluent APICSVFormat.withCommentMarker(Character)public Character getDelimiter()
null then the default one of the format used.public CsvDataFormat setDelimiter(Character delimiter)
null then the default one of the format used.delimiter - DelimiterCsvDataFormat, fluent APICSVFormat.withDelimiter(char)public boolean isEscapeDisabled()
true if the escaping is disabled, false otherwisepublic CsvDataFormat setEscapeDisabled(boolean escapeDisabled)
escapeDisabled - true if the escaping is disabled, false otherwiseCsvDataFormat, fluent APICSVFormat.withEscape(Character)public Character getEscape()
null then the default one of the format used.public CsvDataFormat setEscape(Character escape)
null then the default one of the format used.escape - Escape characterCsvDataFormat, fluent APICSVFormat.withEscape(Character)public boolean isHeaderDisabled()
true if the headers are disabled, false otherwisepublic CsvDataFormat setHeaderDisabled(boolean headerDisabled)
headerDisabled - true if the headers are disabled, false otherwiseCsvDataFormat, fluent APICSVFormat.withHeader(String...)public String[] getHeader()
null then the default one of the format used. If empty then it will be automatically handled.public CsvDataFormat setHeader(String[] header)
null then the default one of the format used. If empty then it will be automatically handled.header - HeaderCsvDataFormat, fluent APICSVFormat.withHeader(String...)public Boolean getAllowMissingColumnNames()
null then the default value of the format used.public CsvDataFormat setAllowMissingColumnNames(Boolean allowMissingColumnNames)
null then the default value of the format used.allowMissingColumnNames - Whether or not missing column names are allowedCsvDataFormat, fluent APICSVFormat.withAllowMissingColumnNames(boolean)public Boolean getIgnoreEmptyLines()
null then the default value of the format used.public CsvDataFormat setIgnoreEmptyLines(Boolean ignoreEmptyLines)
null then the default value of the format used.ignoreEmptyLines - Whether or not empty lines must be ignoredCsvDataFormat, fluent APICSVFormat.withIgnoreEmptyLines(boolean)public Boolean getIgnoreSurroundingSpaces()
null then the default value of the format used.public CsvDataFormat setIgnoreSurroundingSpaces(Boolean ignoreSurroundingSpaces)
null then the default value of the format used.ignoreSurroundingSpaces - Whether or not surrounding spaces must be ignoredCsvDataFormat, fluent APICSVFormat.withIgnoreSurroundingSpaces(boolean)public boolean isNullStringDisabled()
true if the null string replacement is disabled, false otherwisepublic CsvDataFormat setNullStringDisabled(boolean nullStringDisabled)
nullStringDisabled - true if the null string replacement is disabled, false otherwiseCsvDataFormat, fluent APICSVFormat.withNullString(String)public String getNullString()
null then the default one of the format used.public CsvDataFormat setNullString(String nullString)
null then the default one of the format used.nullString - Null string replacementCsvDataFormat, fluent APICSVFormat.withNullString(String)public boolean isQuoteDisabled()
true if quotes are disabled, false otherwisepublic CsvDataFormat setQuoteDisabled(boolean quoteDisabled)
quoteDisabled - true if quotes are disabled, false otherwiseCsvDataFormat, fluent APICSVFormat.withQuote(Character)public Character getQuote()
null then the default one of the format used.public CsvDataFormat setQuote(Character quote)
null then the default one of the format used.quote - Quote characterCsvDataFormat, fluent APICSVFormat.withQuote(Character)public org.apache.commons.csv.QuoteMode getQuoteMode()
null then the default one of the format used.public CsvDataFormat setQuoteMode(org.apache.commons.csv.QuoteMode quoteMode)
null then the default one of the format used.quoteMode - Quote modeCsvDataFormat, fluent APICSVFormat.withQuoteMode(org.apache.commons.csv.QuoteMode)public boolean isRecordSeparatorDisabled()
true if the record separator disabled, false otherwisepublic CsvDataFormat setRecordSeparatorDisabled(boolean recordSeparatorDisabled)
recordSeparatorDisabled - true if the record separator disabled, false otherwiseCsvDataFormat, fluent APICSVFormat.withRecordSeparator(String)public String getRecordSeparator()
null then the default one of the format used.public CsvDataFormat setRecordSeparator(String recordSeparator)
null then the default one of the format used.recordSeparator - Record separatorCsvDataFormat, fluent APICSVFormat.withRecordSeparator(String)public Boolean getSkipHeaderRecord()
null then the default value of the format used.public CsvDataFormat setSkipHeaderRecord(Boolean skipHeaderRecord)
null then the default value of the format used.skipHeaderRecord - Whether or not header record must be skippedCsvDataFormat, fluent APICSVFormat.withSkipHeaderRecord(boolean)public boolean isLazyLoad()
true for lazy loading, false otherwisepublic CsvDataFormat setLazyLoad(boolean lazyLoad)
lazyLoad - true for lazy loading, false otherwiseCsvDataFormat, fluent APIpublic boolean isUseMaps()
true for maps, false for listspublic CsvDataFormat setUseMaps(boolean useMaps)
useMaps - true for maps, false for listsCsvDataFormat, fluent APIpublic boolean isUseOrderedMaps()
true for maps, false for listspublic CsvDataFormat setUseOrderedMaps(boolean useOrderedMaps)
useOrderedMaps - true for maps, false for listsCsvDataFormat, fluent APIpublic CsvRecordConverter<?> getRecordConverter()
null then it will use isUseMaps() for finding
the proper converter.public CsvDataFormat setRecordConverter(CsvRecordConverter<?> recordConverter)
null then it will use isUseMaps() for finding
the proper converter.recordConverter - Record converter to useCsvDataFormat, fluent APIpublic CsvDataFormat setTrim(Boolean trim)
If null then the default value of the format used.
trim - whether or not to trim leading and trailing blanks.
null value allowed.CsvDataFormat, fluent API.public Boolean getTrim()
Boolean.TRUE if leading and trailing blanks should be
trimmed. Boolean.FALSE otherwise. Could return
null if value has NOT been set.public CsvDataFormat setIgnoreHeaderCase(Boolean ignoreHeaderCase)
If null then the default value of the format used.
ignoreHeaderCase - whether or not to ignore case when accessing header names.
null value allowed.CsvDataFormat, fluent API.public Boolean getIgnoreHeaderCase()
Boolean.TRUE if case should be ignored when accessing
header name. Boolean.FALSE otherwise. Could return
null if value has NOT been set.public CsvDataFormat setTrailingDelimiter(Boolean trailingDelimiter)
If null then the default value of the format used.
trailingDelimiter - whether or not to add a trailing delimiter.CsvDataFormat, fluent API.public Boolean getTrailingDelimiter()
Boolean.TRUE if a trailing delimiter should be added.
Boolean.FALSE otherwise. Could return null
if value has NOT been set.Apache Camel