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