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.
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private static final String[] | |
| private String[] | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| private | NamedCsvRecordHandler(final int maxFields, final int maxFieldSize, final int maxRecordSize, final FieldModifier fieldModifier, final boolean allowDuplicateHeaderFields, final boolean returnHeader, final List<String> header)
|
| Modifier and Type | Method and Description |
|---|---|
| public static NamedCsvRecordHandler. | |
| protected NamedCsvRecord | buildRecord()
Implements abstract de. Called at the end of each CSV record to build the actual record representation. |
| private static void | |
| public static NamedCsvRecordHandler | |
| public static NamedCsvRecordHandler | Returns: the new instancethe configuration, must not be configurernullConstructs a new instance of this class with the given configuration. |
| private String[] |
| allowDuplicateHeaderFields | back to summary |
|---|---|
| private final boolean allowDuplicateHeaderFields | |
| EMPTY_HEADER | back to summary |
|---|---|
| private static final String[] EMPTY_HEADER | |
| header | back to summary |
|---|---|
| private String[] header
| |
| returnHeader | back to summary |
|---|---|
| private final boolean returnHeader | |
| NamedCsvRecordHandler | back to summary |
|---|---|
| private NamedCsvRecordHandler(final int maxFields, final int maxFieldSize, final int maxRecordSize, final FieldModifier fieldModifier, final boolean allowDuplicateHeaderFields, final boolean returnHeader, final List<String> header) | |
| builder | back to summary |
|---|---|
| public static NamedCsvRecordHandler. Constructs a new builder instance for this class.
| |
| buildRecord | back to summary |
|---|---|
| protected NamedCsvRecord buildRecord() Implements abstract de. Doc from de. Called at the end of each CSV record to build the actual record representation. | |
| checkForDuplicates | back to summary |
|---|---|
private static void checkForDuplicates(final String[] header)
| |
| of | back to summary |
|---|---|
| public static NamedCsvRecordHandler of() Constructs a new instance of this class with default settings.
| |
| of | back to summary |
|---|---|
| public static NamedCsvRecordHandler of(final Consumer<NamedCsvRecordHandler. Constructs a new instance of this class with the given configuration. This is an alternative to the builder pattern for convenience.
| |
| validateHeader | back to summary |
|---|---|
private String[] validateHeader(final String[] fields)
| |
NamedCsvRecordHandler.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private List | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public NamedCsvRecordHandler. | Returns: This updated object, allowing additional method calls to be chained together.whether duplicate header fields are allowed (default: allowDuplicateHeaderFields)false)Sets whether duplicate header fields are allowed. |
| public NamedCsvRecordHandler | |
| public NamedCsvRecordHandler. | |
| public NamedCsvRecordHandler. | |
| public NamedCsvRecordHandler. | Returns: This updated object, allowing additional method calls to be chained together.whether the header should be returned as the first record (default: returnHeader)false)Sets whether the header itself should be returned as the first record. |
| protected NamedCsvRecordHandler. | self()
Implements abstract de. Method to be implemented by subclasses to return the correct type. |
| allowDuplicateHeaderFields | back to summary |
|---|---|
| private boolean allowDuplicateHeaderFields | |
| header | back to summary |
|---|---|
| private List<String> header
| |
| returnHeader | back to summary |
|---|---|
| private boolean returnHeader | |
| NamedCsvRecordHandlerBuilder | back to summary |
|---|---|
| private NamedCsvRecordHandlerBuilder() | |
| allowDuplicateHeaderFields | back to summary |
|---|---|
| public NamedCsvRecordHandler. Sets whether duplicate header fields are allowed. When set to
| |
| build | back to summary |
|---|---|
| public NamedCsvRecordHandler build() Builds the
| |
| header | back to summary |
|---|---|
| public NamedCsvRecordHandler. Sets a predefined header. When not set, the header is taken from the first record (that is not a comment).
| |
| header | back to summary |
|---|---|
| public NamedCsvRecordHandler. Sets the header. When not set, the header is taken from the first record (that is not a comment).
| |
| returnHeader | back to summary |
|---|---|
| public NamedCsvRecordHandler. Sets whether the header itself should be returned as the first record. When enabled, the first record returned will be a
| |
| self | back to summary |
|---|---|
| protected NamedCsvRecordHandler. Implements abstract de. Method to be implemented by subclasses to return the correct type.
| |