public class HeaderColumnNameMappingStrategy<T> extends Object implements MappingStrategy<T>
Modifier and Type | Field and Description |
---|---|
protected Map<String,PropertyDescriptor> |
descriptorMap |
protected String[] |
header |
protected Class<T> |
type |
Constructor and Description |
---|
HeaderColumnNameMappingStrategy() |
Modifier and Type | Method and 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.
|
T |
createBean() |
PropertyDescriptor |
findDescriptor(int col)
Implementation will have to return a property descriptor from a bean based on the current column.
|
protected PropertyDescriptor |
findDescriptor(String name) |
protected String |
getColumnName(int col) |
Class<T> |
getType() |
protected Map<String,PropertyDescriptor> |
loadDescriptorMap(Class<T> cls) |
protected boolean |
matches(String name,
PropertyDescriptor desc) |
void |
setType(Class<T> type) |
protected String[] header
protected Map<String,PropertyDescriptor> descriptorMap
public void captureHeader(CSVReader reader) throws IOException
MappingStrategy
captureHeader
in interface MappingStrategy<T>
reader
- the CSVReader to use for header parsingIOException
- if parsing failspublic PropertyDescriptor findDescriptor(int col) throws IntrospectionException
MappingStrategy
findDescriptor
in interface MappingStrategy<T>
col
- the column to find the description forIntrospectionException
protected String getColumnName(int col)
protected PropertyDescriptor findDescriptor(String name) throws IntrospectionException
IntrospectionException
protected boolean matches(String name, PropertyDescriptor desc)
protected Map<String,PropertyDescriptor> loadDescriptorMap(Class<T> cls) throws IntrospectionException
IntrospectionException
public T createBean() throws InstantiationException, IllegalAccessException
createBean
in interface MappingStrategy<T>
InstantiationException
IllegalAccessException
Copyright © 2019. All rights reserved.