spring-batch-extensions
spring-batch-extensions copied to clipboard
Support parsing rows to other data types than String[]
Columns in Excel files being batch processed may contain numbers or dates. Currently all rows are parsed into String[]
(see Sheet line 47). spring-batch-excel
interfaces should use generics to support other representations of a row, such as Object[]
.
I am using this spring-batch-excel in our application, It is automatically converting the number fields with .0 to make it as number. Could you please let me know how to disable this auto conversion and let the RowMapper returns always string for all cloumns.
If you've built spring-batch-excel
from my pull request, have a look at the test cases to see how to still get String
for all columns.
The issue is that when using a streaming result the result is always a formatted cell value as a String
. What would be the better solution is to make methods on the RowSet
to get the value of a row as a specific type. Just like the SQL based SqlRowSet
which has getLong
, getDate
for specific columns. That way you can get the specified result from the RowSet
to use in the RowMapper
.
For a classis PoiSheet
we could use the underlying sheet/row to get the values (as you can get the value as is from the cell) for the StreamingSheet
we would need to convert the String
back to the specific type, for this we could use the Spring Framework ConversionService
?