Class FlatFileItemReaderBuilder.DelimitedBuilder<T>
java.lang.Object
org.springframework.batch.item.file.builder.FlatFileItemReaderBuilder.DelimitedBuilder<T>
- Type Parameters:
T
- the type of the parentFlatFileItemReaderBuilder
- Enclosing class:
- FlatFileItemReaderBuilder<T>
A builder for constructing a
DelimitedLineTokenizer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddIncludedField
(int field) Add an index to the list of fields to be included from the filebuild()
Returns aDelimitedLineTokenizer
Define the delimiter for the file.fieldSetFactory
(FieldSetFactory fieldSetFactory) A factory for creating the resultingFieldSet
.includedFields
(Integer... fields) A list of indices of the fields within a delimited file to be includedNames of each of the fields within the fields that are returned in the order they occur within the delimited file.quoteCharacter
(char quoteCharacter) Define the character used to quote fields.strict
(boolean strict) If true (the default) then the number of tokens in line must match the number of tokens defined (byRange
, columns, etc.) inLineTokenizer
.
-
Constructor Details
-
DelimitedBuilder
-
-
Method Details
-
delimiter
Define the delimiter for the file.- Parameters:
delimiter
- String used as a delimiter between fields.- Returns:
- The instance of the builder for chaining.
- See Also:
-
quoteCharacter
Define the character used to quote fields.- Parameters:
quoteCharacter
- char used to define quoted fields- Returns:
- The instance of the builder for chaining.
- See Also:
-
includedFields
A list of indices of the fields within a delimited file to be included- Parameters:
fields
- indices of the fields- Returns:
- The instance of the builder for chaining.
- See Also:
-
addIncludedField
Add an index to the list of fields to be included from the file- Parameters:
field
- the index to be included- Returns:
- The instance of the builder for chaining.
- See Also:
-
fieldSetFactory
public FlatFileItemReaderBuilder.DelimitedBuilder<T> fieldSetFactory(FieldSetFactory fieldSetFactory) A factory for creating the resultingFieldSet
. Defaults toDefaultFieldSetFactory
.- Parameters:
fieldSetFactory
- Factory for creatingFieldSet
- Returns:
- The instance of the builder for chaining.
- See Also:
-
names
Names of each of the fields within the fields that are returned in the order they occur within the delimited file. Required.- Parameters:
names
- names of each field- Returns:
- The parent
FlatFileItemReaderBuilder
- See Also:
-
strict
If true (the default) then the number of tokens in line must match the number of tokens defined (byRange
, columns, etc.) inLineTokenizer
. If false then lines with less tokens will be tolerated and padded with empty columns, and lines with more tokens will simply be truncated.- Parameters:
strict
- the strict flag to set- Since:
- 5.1
-
build
Returns aDelimitedLineTokenizer
- Returns:
DelimitedLineTokenizer
-