- java.lang.Object
-
- de.siegmar.fastcsv.reader.CsvCallbackHandler<T>
-
- de.siegmar.fastcsv.reader.AbstractCsvCallbackHandler<NamedCsvRecord>
-
- de.siegmar.fastcsv.reader.NamedCsvRecordHandler
-
public final class NamedCsvRecordHandler extends AbstractCsvCallbackHandler<NamedCsvRecord>
A callback handler that returns aNamedCsvRecordfor each record.This implementation is stateful and must not be reused.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String[]EMPTY_HEADERprivate java.lang.String[]header-
Fields inherited from class de.siegmar.fastcsv.reader.AbstractCsvCallbackHandler
comment, emptyLine, fieldIdx, fieldModifier, fields, recordSize, startingLineNumber
-
-
Constructor Summary
Constructors Constructor Description NamedCsvRecordHandler()Constructs a newNamedCsvRecordHandlerwith an empty header.NamedCsvRecordHandler(FieldModifier fieldModifier)Constructs a newNamedCsvRecordHandlerwith the given field modifier.NamedCsvRecordHandler(FieldModifier fieldModifier, java.lang.String... header)Constructs a newNamedCsvRecordHandlerwith the given header and field modifier.NamedCsvRecordHandler(FieldModifier fieldModifier, java.util.List<java.lang.String> header)Constructs a newNamedCsvRecordHandlerwith the given header and field modifier.NamedCsvRecordHandler(java.lang.String... header)Constructs a newNamedCsvRecordHandlerwith the given header.NamedCsvRecordHandler(java.util.List<java.lang.String> header)Constructs a newNamedCsvRecordHandlerwith the given header.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RecordWrapper<NamedCsvRecord>buildRecord()Called at the end of each CSV record to build an object representation of the record.private voidsetHeader(java.lang.String... header)-
Methods inherited from class de.siegmar.fastcsv.reader.AbstractCsvCallbackHandler
addField, addField, beginRecord, buildWrapper, compactFields, materializeComment, materializeField, modifyComment, modifyField, setComment, setComment
-
Methods inherited from class de.siegmar.fastcsv.reader.CsvCallbackHandler
terminate
-
-
-
-
Constructor Detail
-
NamedCsvRecordHandler
public NamedCsvRecordHandler()
Constructs a newNamedCsvRecordHandlerwith an empty header.
-
NamedCsvRecordHandler
public NamedCsvRecordHandler(java.util.List<java.lang.String> header)
Constructs a newNamedCsvRecordHandlerwith the given header.- Parameters:
header- the header, must not benullor containnullelements- Throws:
java.lang.NullPointerException- ifnullis passed
-
NamedCsvRecordHandler
public NamedCsvRecordHandler(java.lang.String... header)
Constructs a newNamedCsvRecordHandlerwith the given header.- Parameters:
header- the header, must not benullor containnullelements- Throws:
java.lang.NullPointerException- ifnullis passed
-
NamedCsvRecordHandler
public NamedCsvRecordHandler(FieldModifier fieldModifier)
Constructs a newNamedCsvRecordHandlerwith the given field modifier.- Parameters:
fieldModifier- the field modifier, must not benull- Throws:
java.lang.NullPointerException- ifnullis passed
-
NamedCsvRecordHandler
public NamedCsvRecordHandler(FieldModifier fieldModifier, java.util.List<java.lang.String> header)
Constructs a newNamedCsvRecordHandlerwith the given header and field modifier.- Parameters:
fieldModifier- the field modifier, must not benullheader- the header, must not benullor containnullelements- Throws:
java.lang.NullPointerException- ifnullis passed
-
NamedCsvRecordHandler
public NamedCsvRecordHandler(FieldModifier fieldModifier, java.lang.String... header)
Constructs a newNamedCsvRecordHandlerwith the given header and field modifier.- Parameters:
fieldModifier- the field modifier, must not benullheader- the header, must not benullor containnullelements- Throws:
java.lang.NullPointerException- ifnullis passed
-
-
Method Detail
-
setHeader
private void setHeader(java.lang.String... header)
-
buildRecord
protected RecordWrapper<NamedCsvRecord> buildRecord()
Description copied from class:CsvCallbackHandlerCalled at the end of each CSV record to build an object representation of the record.The returned wrapper is used by the
CsvReaderin order to determine how to process the record.- Specified by:
buildRecordin classCsvCallbackHandler<NamedCsvRecord>- Returns:
- the record wrapper or
nullif the record should be ignored/skipped
-
-