T
- Class to be mapped.public class HeaderColumnNameTranslateMappingStrategy<T> extends HeaderNameBaseMappingStrategy<T>
HeaderColumnNameMappingStrategy
by allowing the user to
pass in a map of column names to bean names.
This way the fields in the bean do not have to match the fields in the CSV
file. This is only for when the user passes in the header names
programmatically, and not for annotated beans.AbstractMappingStrategy.RecursiveType
fieldMap, forceCorrectRecordLength, writeOrder
errorLocale, headerIndex, profile, recursiveTypeTree, type
Constructor and Description |
---|
HeaderColumnNameTranslateMappingStrategy()
Default constructor.
|
HeaderColumnNameTranslateMappingStrategy(boolean forceCorrectRecordLength)
Constructor to allow setting options for header name mapping.
|
Modifier and Type | Method and Description |
---|---|
Map<String,String> |
getColumnMapping()
Retrieves the column mappings of the strategy.
|
String |
getColumnName(int col)
Get the column name for a given column position.
|
void |
setColumnMapping(Map<String,String> columnMapping)
Sets the column mapping to those passed in.
|
captureHeader, chooseMultivaluedFieldIndexFromHeaderIndex, findField, findHeader, getFieldMap, initializeFieldMap, loadUnadornedFieldMap, setColumnOrderOnWrite, verifyLineLength
createBean, determineConverter, filterIgnoredFields, generateHeader, getBindingAnnotations, getType, ignoreFields, indexBean, instantiateCustomConverter, isForbiddenClassForRecursion, loadAnnotatedFieldMap, loadFieldMap, loadRecursiveClasses, partitionFields, populateNewBean, selectAnnotationForProfile, setErrorLocale, setFieldValue, setProfile, setType, transmuteBean
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isAnnotationDriven
public HeaderColumnNameTranslateMappingStrategy()
public HeaderColumnNameTranslateMappingStrategy(boolean forceCorrectRecordLength)
HeaderColumnNameTranslateMappingStrategyBuilder
.forceCorrectRecordLength
- If set, every record will be shortened
or lengthened to match the number of
headersHeaderColumnNameTranslateMappingStrategyBuilder
public String getColumnName(int col)
AbstractMappingStrategy
getColumnName
in class AbstractMappingStrategy<String,String,ComplexFieldMapEntry<String,String,T>,T>
col
- Column position.public Map<String,String> getColumnMapping()
Copyright © 2005–2023. All rights reserved.