Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to parse non-string values in Opencsv HeaderColumnNameMappingStrategy
    primarykey
    data
    text
    <p>I'm using a HeaderColumnNameMappingStrategy to map a csv file with a header into a JavaBean. String values parse fine but any "true" or "false" value in csv doesn't map to JavaBean and I get the following exception from the PropertyDescriptor:</p> <pre><code>java.lang.IllegalArgumentException: argument type mismatch </code></pre> <p>The code where it occurs is in CsvToBean, line 64:</p> <pre><code>protected T processLine(MappingStrategy&lt;T&gt; mapper, String[] line) throws IllegalAccessException, InvocationTargetException, InstantiationException, IntrospectionException { T bean = mapper.createBean(); for(int col = 0; col &lt; line.length; col++) { String value = line[col]; PropertyDescriptor prop = mapper.findDescriptor(col); if (null != prop) { Object obj = convertValue(value, prop); // this is where exception is thrown for a "true" value in csv prop.getWriteMethod().invoke(bean, new Object[] {obj}); } } return bean; } protected PropertyEditor getPropertyEditor(PropertyDescriptor desc) throws InstantiationException, IllegalAccessException { Class&lt;?&gt; cls = desc.getPropertyEditorClass(); if (null != cls) return (PropertyEditor) cls.newInstance(); return getPropertyEditorValue(desc.getPropertyType()); } </code></pre> <p>I can confirm (via debugger) that the setter method id correctly retrieved at this point.</p> <p>The problem occurs in desc.getPropertyEditorClass() since it returns null. I assumed primitive types and its wrappers are supported. Are they not?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload