Class NamedCsvRecordHandler.NamedCsvRecordHandlerBuilder
java.lang.Object
de.siegmar.fastcsv.reader.AbstractInternalCsvCallbackHandler.AbstractInternalCsvCallbackHandlerBuilder<NamedCsvRecordHandler.NamedCsvRecordHandlerBuilder>
de.siegmar.fastcsv.reader.NamedCsvRecordHandler.NamedCsvRecordHandlerBuilder
- Enclosing class:
NamedCsvRecordHandler
public static final class NamedCsvRecordHandler.NamedCsvRecordHandlerBuilder
extends AbstractInternalCsvCallbackHandler.AbstractInternalCsvCallbackHandlerBuilder<NamedCsvRecordHandler.NamedCsvRecordHandlerBuilder>
A builder for
NamedCsvRecordHandler.-
Field Summary
Fields inherited from class AbstractInternalCsvCallbackHandler.AbstractInternalCsvCallbackHandlerBuilder
fieldModifier, maxFields, maxFieldSize, maxRecordSize -
Method Summary
Modifier and TypeMethodDescriptionallowDuplicateHeaderFields(boolean allowDuplicateHeaderFields) Sets whether duplicate header fields are allowed.build()Builds theNamedCsvRecordHandlerinstance.Sets a predefined header.Sets the header.returnHeader(boolean returnHeader) Sets whether the header itself should be returned as the first record.self()Method to be implemented by subclasses to return the correct type.Methods inherited from class AbstractInternalCsvCallbackHandler.AbstractInternalCsvCallbackHandlerBuilder
fieldModifier, maxFields, maxFieldSize, maxRecordSize
-
Method Details
-
allowDuplicateHeaderFields
public NamedCsvRecordHandler.NamedCsvRecordHandlerBuilder allowDuplicateHeaderFields(boolean allowDuplicateHeaderFields) Sets whether duplicate header fields are allowed.
When set to
false, anIllegalArgumentExceptionis thrown if the header contains duplicate fields. When set totrue, duplicate fields are allowed. SeeNamedCsvRecordfor details on how duplicate headers are handled.- Parameters:
allowDuplicateHeaderFields- whether duplicate header fields are allowed (default:false)- Returns:
- This updated object, allowing additional method calls to be chained together.
-
header
Sets a predefined header.
When not set, the header is taken from the first record (that is not a comment).
- Parameters:
header- the header, must not benull- Returns:
- This updated object, allowing additional method calls to be chained together.
- Throws:
NullPointerException- ifnullis passed- See Also:
-
header
Sets the header.
When not set, the header is taken from the first record (that is not a comment).
- Parameters:
header- the header, must not benull- Returns:
- This updated object, allowing additional method calls to be chained together.
- Throws:
NullPointerException- ifnullis passed- See Also:
-
returnHeader
Sets whether the header itself should be returned as the first record.
When enabled, the first record returned will be a
NamedCsvRecordwith the header fields as its fields and as the header.- Parameters:
returnHeader- whether the header should be returned as the first record (default:false)- Returns:
- This updated object, allowing additional method calls to be chained together.
-
self
Description copied from class:AbstractInternalCsvCallbackHandler.AbstractInternalCsvCallbackHandlerBuilderMethod to be implemented by subclasses to return the correct type.- Specified by:
selfin classAbstractInternalCsvCallbackHandler.AbstractInternalCsvCallbackHandlerBuilder<NamedCsvRecordHandler.NamedCsvRecordHandlerBuilder>- Returns:
- This object of subclass type.
-
build
Builds theNamedCsvRecordHandlerinstance.- Returns:
- the new instance
- Throws:
IllegalArgumentException- if argument constraints are violated (seeAbstractInternalCsvCallbackHandler)
-