liquibase.util.csv.opencsv.bean
Class HeaderColumnNameTranslateMappingStrategy<T>

java.lang.Object
  extended by liquibase.util.csv.opencsv.bean.HeaderColumnNameMappingStrategy<T>
      extended by liquibase.util.csv.opencsv.bean.HeaderColumnNameTranslateMappingStrategy<T>
Type Parameters:
T - - class to be mapped.
All Implemented Interfaces:
MappingStrategy<T>

public class HeaderColumnNameTranslateMappingStrategy<T>
extends HeaderColumnNameMappingStrategy<T>

Expands on 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.


Field Summary
 
Fields inherited from class liquibase.util.csv.opencsv.bean.HeaderColumnNameMappingStrategy
annotationDriven, descriptorMap, determinedIfAnnotationDriven, fieldMap, header, indexLookup, type
 
Constructor Summary
HeaderColumnNameTranslateMappingStrategy()
          Default constructor.
 
Method Summary
 Map<String,String> getColumnMapping()
          retrieves the column mappings of the strategy.
 String getColumnName(int col)
          Retrieves the column name for a given column position
 void setColumnMapping(Map<String,String> columnMapping)
          Sets the column mapping to those passed in.
 
Methods inherited from class liquibase.util.csv.opencsv.bean.HeaderColumnNameMappingStrategy
captureHeader, createBean, createIndexLookup, findDescriptor, findDescriptor, findField, findField, getColumnIndex, getType, isAnnotationDriven, loadDescriptorMap, loadFieldMap, matches, resetIndexMap, setType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HeaderColumnNameTranslateMappingStrategy

public HeaderColumnNameTranslateMappingStrategy()
Default constructor.

Method Detail

getColumnName

public String getColumnName(int col)
Retrieves the column name for a given column position

Overrides:
getColumnName in class HeaderColumnNameMappingStrategy<T>
Parameters:
col - - column position.
Returns:
- The column name.

getColumnMapping

public Map<String,String> getColumnMapping()
retrieves the column mappings of the strategy.

Returns:
- the column mappings of the strategy.

setColumnMapping

public void setColumnMapping(Map<String,String> columnMapping)
Sets the column mapping to those passed in.

Parameters:
columnMapping - - source column mapping.


Copyright © 2016 Liquibase.org. All rights reserved.