Package com.opencsv.bean
Class HeaderColumnNameMappingStrategyBuilder<T>
- java.lang.Object
-
- com.opencsv.bean.HeaderColumnNameMappingStrategyBuilder<T>
-
- Type Parameters:
T
- The type of the bean being processed
public class HeaderColumnNameMappingStrategyBuilder<T> extends java.lang.Object
Builder for aHeaderColumnNameMappingStrategy
. This allows opencsv to introduce new options for mapping strategies while maintaining backward compatibility and without creating reams of constructors for the mapping strategy.- Since:
- 5.5
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
forceCorrectRecordLength
-
Constructor Summary
Constructors Constructor Description HeaderColumnNameMappingStrategyBuilder()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HeaderColumnNameMappingStrategy<T>
build()
Builds a new mapping strategy for parsing/writing.HeaderColumnNameMappingStrategyBuilder<T>
withForceCorrectRecordLength(boolean forceCorrectRecordLength)
Insists that every record will be considered to be of the correct length (that is, the same number of columns as the header).
-
-
-
Method Detail
-
build
public HeaderColumnNameMappingStrategy<T> build()
Builds a new mapping strategy for parsing/writing.- Returns:
- A new mapping strategy using the options selected
-
withForceCorrectRecordLength
public HeaderColumnNameMappingStrategyBuilder<T> withForceCorrectRecordLength(boolean forceCorrectRecordLength)
Insists that every record will be considered to be of the correct length (that is, the same number of columns as the header).Excess fields at the end of a record will be ignored. Missing fields at the end of a record will be interpreted as
null
. This is only relevant on reading.If not set, incorrect record length will throw an exception. That is, the default value is
false
.- Parameters:
forceCorrectRecordLength
- Whether records should be forced to the correct length- Returns:
this
-
-