According to the "bindy" component from apache camel. https://camel.apache.org/components/latest/dataformats/bindy-dataformat.html I'm trying to unmarshal simple csv file with kotlin, but pojo filed values don't created.
I think the problem is in unmarshaling with kotlin.
model ->
@CsvRecord(separator = ",", skipField = true)
data class Product(
@DataField(pos = 1, required = true)
var id: String? = null,
@DataField(pos = 2, required = true)
var name: String? = null
) {
override fun toString() = "Product(id=$id, name=$name)"
}
route ->
@Component
class ProductRoute : RouteBuilder() {
override fun configure() {
val bindy = BindyCsvDataFormat(Product::class.java)
from("file://src/main/resources?charset=Cp1250&fileName=products.csv&noop=true")
.log("start -> \${body}")
.unmarshal(bindy)
.split(body())
.log("end -> \${body}")
.end()
}
}
produtcts.csv ->
"1","productName1"
"2","productName2"
Log result ->
INFO route1 - end -> Product(id=null, name=null)
INFO route1 - end -> Product(id=null, name=null)