| Modifier and Type | Field and Description |
|---|---|
| protected FieldMapByName | |
| protected final boolean | forceCorrectRecordLength
If set, every record will be shortened or lengthened to match the number of headers. |
| protected Comparator | writeOrder
Holds a |
| Access | Constructor and Description |
|---|---|
| public | |
| public | HeaderNameBaseMappingStrategy(boolean
If set, every record will be shortened
or lengthened to match the number of
headers forceCorrectRecordLength)Constructor to allow setting options for header name mapping. |
| Modifier and Type | Method and Description |
|---|---|
| public void | captureHeader(CSVReader reader)
Implements com. Implementation of this method can grab the header line before parsing begins to use to map columns to bean properties. |
| protected String | chooseMultivaluedFieldIndexFromHeaderIndex(int index)
Implements abstract com. For |
| protected BeanField | findField(int col)
Implements abstract com. Gets the field for a given column position. |
| public String | findHeader(int col)
Implements abstract com. Gets the name (or position number) of the header for the given column number. |
| protected FieldMap | getFieldMap()
Implements abstract com. Returns the |
| protected void | initializeFieldMap()
Implements abstract com. Creates an empty binding-type-specific field map that can be filled in later steps. |
| protected void | loadUnadornedFieldMap(ListValuedMap<Class<?>, Field> fields)
Implements abstract com. Creates a map of fields in the bean to be processed that have no binding annotations. |
| public void | setColumnOrderOnWrite(Comparator<String>
The writeOrder)java. to use. May be
null, in which case the natural ordering is used.Sets the |
| public void | verifyLineLength(int numberOfFields)
Implements abstract com. Must be called once the length of input for a line/record is known to verify that the line was complete. |
| fieldMap | back to summary |
|---|---|
| protected FieldMapByName<T> fieldMap Given a header name, this map allows one to find the corresponding
| |
| forceCorrectRecordLength | back to summary |
|---|---|
| protected final boolean forceCorrectRecordLength If set, every record will be shortened or lengthened to match the number of headers. | |
| writeOrder | back to summary |
|---|---|
| protected Comparator<String> writeOrder Holds a | |
| HeaderNameBaseMappingStrategy | back to summary |
|---|---|
| public HeaderNameBaseMappingStrategy() Nullary constructor for compatibility. | |
| HeaderNameBaseMappingStrategy | back to summary |
|---|---|
| public HeaderNameBaseMappingStrategy(boolean forceCorrectRecordLength) Constructor to allow setting options for header name mapping.
| |
| captureHeader | back to summary |
|---|---|
| public void captureHeader(CSVReader reader) throws IOException, CsvRequiredFieldEmptyException Implements com. Doc from com. Implementation of this method can grab the header line before parsing begins to use to map columns to bean properties.
| |
| chooseMultivaluedFieldIndexFromHeaderIndex | back to summary |
|---|---|
| protected String chooseMultivaluedFieldIndexFromHeaderIndex(int index) Implements abstract com. Doc from com. For
| |
| findField | back to summary |
|---|---|
| protected BeanField Implements abstract com. Doc from com. Gets the field for a given column position.
| |
| findHeader | back to summary |
|---|---|
| public String findHeader(int col) Implements abstract com. Doc from com. Gets the name (or position number) of the header for the given column number. The column numbers are zero-based.
| |
| getFieldMap | back to summary |
|---|---|
| protected FieldMap Implements abstract com. Doc from com. Returns the
| |
| initializeFieldMap | back to summary |
|---|---|
| protected void initializeFieldMap() Implements abstract com. Doc from com. Creates an empty binding-type-specific field map that can be filled in later steps. This method may be called multiple times and must erase any state information from previous calls.
| |
| loadUnadornedFieldMap | back to summary |
|---|---|
| protected void loadUnadornedFieldMap(ListValuedMap<Class<?>, Field> fields) Implements abstract com. Creates a map of fields in the bean to be processed that have no binding annotations. This method is called by Two exceptions are made to the rule that everything is written:
| |
| setColumnOrderOnWrite | back to summary |
|---|---|
| public void setColumnOrderOnWrite(Comparator<String> writeOrder) Sets the
| |
| verifyLineLength | back to summary |
|---|---|
| public void verifyLineLength(int numberOfFields) throws CsvRequiredFieldEmptyException Implements abstract com. Doc from com. Must be called once the length of input for a line/record is known to verify that the line was complete. Complete in this context means, no required fields are missing. The issue here is, as long as a column is present but empty, we can check whether the field is required and throw an exception if it is not, but if the data end prematurely, we never have this chance without indication that no more data are on the way. Another validation is that the number of fields must match the number of headers to prevent a data mismatch situation.
| |