Class NamedCsvRecordHandler
java.lang.Object
de.siegmar.fastcsv.reader.CsvCallbackHandler<NamedCsvRecord>
de.siegmar.fastcsv.reader.AbstractInternalCsvCallbackHandler<NamedCsvRecord>
de.siegmar.fastcsv.reader.NamedCsvRecordHandler
A callback handler that returns a NamedCsvRecord for each record.
Example:
NamedCsvRecordHandler handler = NamedCsvRecordHandler.builder()
.fieldModifier(FieldModifiers.TRIM)
.header("foo", "bar")
.build();
This implementation is stateful and must not be reused.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class AbstractInternalCsvCallbackHandler
AbstractInternalCsvCallbackHandler.AbstractInternalCsvCallbackHandlerBuilder<T> -
Field Summary
Fields inherited from class AbstractInternalCsvCallbackHandler
fieldIdx, fieldModifier, fields, maxFields, maxFieldSize, maxRecordSize, recordSize, recordType, startingLineNumber -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Constructs a new builder instance for this class.protected NamedCsvRecordCalled at the end of each CSV record to build the actual record representation.static NamedCsvRecordHandlerof()Constructs a new instance of this class with default settings.static NamedCsvRecordHandlerof(Consumer<NamedCsvRecordHandler.NamedCsvRecordHandlerBuilder> configurer) Constructs a new instance of this class with the given configuration.Methods inherited from class AbstractInternalCsvCallbackHandler
addField, beginRecord, compactFields, getFieldCount, getRecordType, modifyComment, modifyField, setComment, setEmptyMethods inherited from class CsvCallbackHandler
terminate
-
Method Details
-
builder
Constructs a new builder instance for this class.- Returns:
- the builder
- See Also:
-
of
Constructs a new instance of this class with default settings.- Returns:
- the new instance
- See Also:
-
of
public static NamedCsvRecordHandler of(Consumer<NamedCsvRecordHandler.NamedCsvRecordHandlerBuilder> configurer) Constructs a new instance of this class with the given configuration.
This is an alternative to the builder pattern for convenience.
- Parameters:
configurer- the configuration, must not benull- Returns:
- the new instance
- Throws:
NullPointerException- ifnullis passedIllegalArgumentException- if argument constraints are violated- See Also:
-
buildRecord
Description copied from class:CsvCallbackHandlerCalled at the end of each CSV record to build the actual record representation.- Specified by:
buildRecordin classCsvCallbackHandler<NamedCsvRecord>- Returns:
- the record or
nullif the record should be ignored/skipped as it is consumed by the callback handler.
-