Package com.opencsv.bean
Class FuzzyMappingStrategy<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>
-
- com.opencsv.bean.FuzzyMappingStrategy<T>
-
- Type Parameters:
T
- The type of bean being processed
- All Implemented Interfaces:
MappingStrategy<T>
public class FuzzyMappingStrategy<T> extends HeaderColumnNameMappingStrategy<T>
A mapping strategy that tries to make the best match between header names and non-annotated member variables.- Since:
- 5.0
- Author:
- Andrew Rucker Jones
-
-
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 FuzzyMappingStrategy()
Nullary constructor to make the style checker happy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
captureHeader(CSVReader reader)
Implementation of this method can grab the header line before parsing begins to use to map columns to bean properties.protected void
loadUnadornedFieldMap(org.apache.commons.collections4.ListValuedMap<java.lang.Class<?>,java.lang.reflect.Field> fields)
This implementation intentionally does nothing in order to allow fuzzy matching in case there are no annotations at all in the class in question.-
Methods inherited from class com.opencsv.bean.HeaderColumnNameMappingStrategy
getBindingAnnotations, loadAnnotatedFieldMap
-
Methods inherited from class com.opencsv.bean.HeaderNameBaseMappingStrategy
chooseMultivaluedFieldIndexFromHeaderIndex, findField, findHeader, getFieldMap, initializeFieldMap, 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
-
loadUnadornedFieldMap
protected void loadUnadornedFieldMap(org.apache.commons.collections4.ListValuedMap<java.lang.Class<?>,java.lang.reflect.Field> fields)
This implementation intentionally does nothing in order to allow fuzzy matching in case there are no annotations at all in the class in question.- Overrides:
loadUnadornedFieldMap
in classHeaderNameBaseMappingStrategy<T>
- Parameters:
fields
- A list of all non-synthetic fields in the bean to be processed
-
captureHeader
public void captureHeader(CSVReader reader) throws java.io.IOException, CsvRequiredFieldEmptyException
Description copied from interface:MappingStrategy
Implementation of this method can grab the header line before parsing begins to use to map columns to bean properties.- Specified by:
captureHeader
in interfaceMappingStrategy<T>
- Overrides:
captureHeader
in classHeaderNameBaseMappingStrategy<T>
- Parameters:
reader
- The CSVReader to use for header parsing- Throws:
java.io.IOException
- If parsing failsCsvRequiredFieldEmptyException
- If a field is required, but the header or column position for the field is not present in the input
-
-