Package com.opencsv.bean
Class HeaderColumnNameMappingStrategy<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.HeaderColumnNameMappingStrategy<T>
-
- Type Parameters:
T
- Type of the bean to be returned
- All Implemented Interfaces:
MappingStrategy<T>
- Direct Known Subclasses:
FuzzyMappingStrategy
public class HeaderColumnNameMappingStrategy<T> extends HeaderNameBaseMappingStrategy<T>
Maps data to objects using the column names in the first row of the CSV file as reference. This way the column order does not matter.
-
-
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 HeaderColumnNameMappingStrategy()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>>
getBindingAnnotations()
Returns a set of the annotations that are used for binding in this mapping strategy.protected void
loadAnnotatedFieldMap(org.apache.commons.collections4.ListValuedMap<java.lang.Class<?>,java.lang.reflect.Field> fields)
Creates a map of annotated fields in the bean to be processed.-
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, getType, ignoreFields, indexBean, instantiateCustomConverter, 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
-
loadAnnotatedFieldMap
protected void loadAnnotatedFieldMap(org.apache.commons.collections4.ListValuedMap<java.lang.Class<?>,java.lang.reflect.Field> fields)
Creates a map of annotated fields in the bean to be processed.This method is called by
AbstractMappingStrategy.loadFieldMap()
when at least one relevant annotation is found on a member variable.- Overrides:
loadAnnotatedFieldMap
in classAbstractMappingStrategy<java.lang.String,java.lang.String,ComplexFieldMapEntry<java.lang.String,java.lang.String,T>,T>
- Parameters:
fields
- A list of fields annotated with a binding annotation in the bean to be processed
-
getBindingAnnotations
protected java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> getBindingAnnotations()
Returns a set of the annotations that are used for binding in this mapping strategy.In this mapping strategy, those are currently:
- Overrides:
getBindingAnnotations
in classAbstractMappingStrategy<java.lang.String,java.lang.String,ComplexFieldMapEntry<java.lang.String,java.lang.String,T>,T>
- Returns:
- Annotations of the sort
CsvBindByName
orCsvBindByPosition
that are relevant for binding input fields to bean members in this mapping strategy
-
-