Class CsvPipelineInput
java.lang.Object
com.northconcepts.datapipeline.foundations.core.Bean
com.northconcepts.datapipeline.foundations.core.FoundationObject
com.northconcepts.datapipeline.foundations.pipeline.PipelineObject
com.northconcepts.datapipeline.foundations.pipeline.PipelineInput
com.northconcepts.datapipeline.foundations.pipeline.input.FileSourcePipelineInput
com.northconcepts.datapipeline.foundations.pipeline.input.CsvPipelineInput
- All Implemented Interfaces:
DataExceptionContributor,JsonSerializable,RecordSerializable,XmlSerializable,DataReaderFactory,JavaCodeGenerator,Serializable
Reads a pipeline's source data from a CSV or other delimited
FileSource using a CSVReader.- See Also:
-
Field Summary
Fields inherited from class com.northconcepts.datapipeline.foundations.core.FoundationObject
internalId, internalName, log, TIMESTAMP_FORMATFields inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
SERIALIZED_CLASS_NAME, TYPEFields inherited from interface com.northconcepts.datapipeline.core.XmlSerializable
XML_SERIALIZED_CLASS_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfromRecord(Record source) Loads this instance's state from a record and returnsthis(for fluid API call chaining).fromXmlElement(Element pipelineInputElement) voidAppends Java source code representing this object to the given builder.Returns the character set used to read the file (defaults to UTF-8); blank uses the platform default.Returns the string that ends a quoted value (defaults to a double quote).Returns the string used between field values (defaults to comma).Returns the line separators as a comma-separated list of Java-escaped strings, as serialized.getLineSeparatorAsCsvEscaped(String separator) Returns the line separators, Java-escaped and joined by the given separator, or an empty string if there are none.String[]Returns the strings that separate records (defaults to LF, CRLF and CR).getName()Returns a display name for this input, such as the source's name followed by its format.Returns the string that starts a quoted value (defaults to a double quote).booleanIndicates if line separators are allowed inside quoted fields (defaults to false).booleanIndicates if unescaped quotes are allowed in fields (defaults to false).booleanIndicates if the first row holds the field names (defaults to false).booleanIndicates if this input can save data lineage on the records it reads (false unless a subclass overrides it).booleanIndicates if rows with only null values are skipped (defaults to false).booleanIndicates if whitespace around unquoted values is removed (defaults to true).setAllowMultiLineText(boolean allowMultiLineText) Indicates if line separators are allowed inside quoted fields (defaults to false).setAllowQuoteInField(boolean allowQuoteInField) Indicates if unescaped quotes are allowed in fields (defaults to false).setCharset(String charset) Sets the character set used to read the file (defaults to UTF-8); blank uses the platform default.setEndingQuote(String endingQuote) Sets the string that ends a quoted value (defaults to a double quote).setFieldNamesInFirstRow(boolean fieldNamesInFirstRow) Indicates if the first row holds the field names (defaults to false).setFieldSeparator(String fieldSeparator) Sets the string used between field values (defaults to comma).setFileSource(FileSource fileSource) setLineSeparatorAsCsvEscaped(String lineSeparatorsAsCsvEscaped) Sets the line separators from a comma-separated list of Java-escaped strings; blank restores the defaults.setLineSeparators(String[] lineSeparators) Sets the strings that separate records (defaults to LF, CRLF and CR).setSaveLineage(boolean saveLineage) Indicates if data lineage (where each record and field came from) is saved on the records read (defaults to false); enabling it throws an exception if lineage is not supported.setSkipEmptyRows(boolean skipEmptyRows) Indicates if rows with only null values are skipped (defaults to false).setStartingQuote(String startingQuote) Sets the string that starts a quoted value (defaults to a double quote).setTrimFields(boolean trimFields) Indicates if whitespace around unquoted values is removed (defaults to true).toRecord()Converts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.toXmlElement(Document document) Returns an element, created withdocument, describing this object; the default implementation throws aDataException.Methods inherited from class com.northconcepts.datapipeline.foundations.pipeline.PipelineInput
getNestedPipelineInput, getPipelineInput, getRootPipelineInput, isSaveLineageMethods inherited from class com.northconcepts.datapipeline.foundations.core.FoundationObject
addExceptionProperties, assertValid, assertValid, clone, exception, exception, exception, getInternalId, getInternalName, resetInternalIdMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.northconcepts.datapipeline.core.DataExceptionContributor
addExceptionProperties
-
Constructor Details
-
CsvPipelineInput
public CsvPipelineInput()
-
-
Method Details
-
getName
Description copied from class:PipelineInputReturns a display name for this input, such as the source's name followed by its format.- Overrides:
getNamein classFileSourcePipelineInput
-
toRecord
Description copied from interface:RecordSerializableConverts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.- Specified by:
toRecordin interfaceRecordSerializable- Overrides:
toRecordin classPipelineInput
-
fromRecord
Description copied from interface:RecordSerializableLoads this instance's state from a record and returnsthis(for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.- Specified by:
fromRecordin interfaceRecordSerializable- Overrides:
fromRecordin classPipelineInput- Parameters:
source-- Returns:
- this instance.
-
getFileSource
- Specified by:
getFileSourcein classFileSourcePipelineInput
-
setFileSource
- Specified by:
setFileSourcein classFileSourcePipelineInput
-
getFieldSeparator
Returns the string used between field values (defaults to comma). -
setFieldSeparator
Sets the string used between field values (defaults to comma). -
getStartingQuote
Returns the string that starts a quoted value (defaults to a double quote). -
setStartingQuote
Sets the string that starts a quoted value (defaults to a double quote). -
getEndingQuote
Returns the string that ends a quoted value (defaults to a double quote). -
setEndingQuote
Sets the string that ends a quoted value (defaults to a double quote). -
getLineSeparators
Returns the strings that separate records (defaults to LF, CRLF and CR). -
setLineSeparators
Sets the strings that separate records (defaults to LF, CRLF and CR). -
getLineSeparatorAsCsvEscaped
Returns the line separators, Java-escaped and joined by the given separator, or an empty string if there are none. -
getLineSeparatorAsCsvEscaped
Returns the line separators as a comma-separated list of Java-escaped strings, as serialized. -
setLineSeparatorAsCsvEscaped
Sets the line separators from a comma-separated list of Java-escaped strings; blank restores the defaults. -
isAllowMultiLineText
public boolean isAllowMultiLineText()Indicates if line separators are allowed inside quoted fields (defaults to false). -
setAllowMultiLineText
Indicates if line separators are allowed inside quoted fields (defaults to false). -
isAllowQuoteInField
public boolean isAllowQuoteInField()Indicates if unescaped quotes are allowed in fields (defaults to false). -
setAllowQuoteInField
Indicates if unescaped quotes are allowed in fields (defaults to false). -
isTrimFields
public boolean isTrimFields()Indicates if whitespace around unquoted values is removed (defaults to true). -
setTrimFields
Indicates if whitespace around unquoted values is removed (defaults to true). -
isSkipEmptyRows
public boolean isSkipEmptyRows()Indicates if rows with only null values are skipped (defaults to false). -
setSkipEmptyRows
Indicates if rows with only null values are skipped (defaults to false). -
isFieldNamesInFirstRow
public boolean isFieldNamesInFirstRow()Indicates if the first row holds the field names (defaults to false). -
setFieldNamesInFirstRow
Indicates if the first row holds the field names (defaults to false). -
createDataReader
-
generateJavaCode
Description copied from interface:JavaCodeGeneratorAppends Java source code representing this object to the given builder. -
getCharset
Returns the character set used to read the file (defaults to UTF-8); blank uses the platform default. -
setCharset
Sets the character set used to read the file (defaults to UTF-8); blank uses the platform default. -
isLineageSupported
public boolean isLineageSupported()Description copied from class:PipelineInputIndicates if this input can save data lineage on the records it reads (false unless a subclass overrides it).- Overrides:
isLineageSupportedin classPipelineInput
-
setSaveLineage
Description copied from class:PipelineInputIndicates if data lineage (where each record and field came from) is saved on the records read (defaults to false); enabling it throws an exception if lineage is not supported.- Overrides:
setSaveLineagein classPipelineInput
-
toXmlElement
Description copied from interface:XmlSerializableReturns an element, created withdocument, describing this object; the default implementation throws aDataException.- Specified by:
toXmlElementin interfaceXmlSerializable- Overrides:
toXmlElementin classPipelineInput
-
fromXmlElement
- Specified by:
fromXmlElementin interfaceXmlSerializable- Overrides:
fromXmlElementin classPipelineInput
-