Package com.opencsv.bean
Class HeaderColumnNameTranslateMappingStrategy<T>
- java.lang.Object
-
- com.opencsv.bean.AbstractMappingStrategy<java.lang.String,java.lang.String,ComplexFieldMapEntry<java.lang.String,java.lang.String,T>,T>
-
- com.opencsv.bean.HeaderNameBaseMappingStrategy<T>
-
- com.opencsv.bean.HeaderColumnNameTranslateMappingStrategy<T>
-
- Type Parameters:
T
- Class to be mapped.
- All Implemented Interfaces:
MappingStrategy<T>
public class HeaderColumnNameTranslateMappingStrategy<T> extends HeaderNameBaseMappingStrategy<T>
Expands onHeaderColumnNameMappingStrategy
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.
-
-
Field Summary
-
Fields inherited from class com.opencsv.bean.HeaderNameBaseMappingStrategy
fieldMap, writeOrder
-
Fields inherited from class com.opencsv.bean.AbstractMappingStrategy
errorLocale, headerIndex, type
-
-
Constructor Summary
Constructors Constructor Description HeaderColumnNameTranslateMappingStrategy()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.String>
getColumnMapping()
Retrieves the column mappings of the strategy.java.lang.String
getColumnName(int col)
void
setColumnMapping(java.util.Map<java.lang.String,java.lang.String> columnMapping)
Sets the column mapping to those passed in.-
Methods inherited from class com.opencsv.bean.HeaderNameBaseMappingStrategy
captureHeader, chooseMultivaluedFieldIndexFromHeaderIndex, findField, findHeader, getFieldMap, initializeFieldMap, loadUnadornedFieldMap, setColumnOrderOnWrite, verifyLineLength
-
Methods inherited from class com.opencsv.bean.AbstractMappingStrategy
createBean, determineConverter, generateHeader, getBindingAnnotations, getType, ignoreFields, indexBean, instantiateCustomConverter, loadAnnotatedFieldMap, loadFieldMap, loadRecursiveClasses, partitionFields, populateNewBean, setErrorLocale, setFieldValue, setType, transmuteBean
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.opencsv.bean.MappingStrategy
isAnnotationDriven
-
-
-
-
Method Detail
-
getColumnName
public java.lang.String getColumnName(int col)
-
getColumnMapping
public java.util.Map<java.lang.String,java.lang.String> getColumnMapping()
Retrieves the column mappings of the strategy.- Returns:
- The column mappings of the strategy.
-
setColumnMapping
public void setColumnMapping(java.util.Map<java.lang.String,java.lang.String> columnMapping)
Sets the column mapping to those passed in.- Parameters:
columnMapping
- Source column mapping.
-
-