Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bindy - Apache Camel. Can a position (column) be ignored while unmarshaling CSV?

I am using camel-bindy to unmarshall a CSV to Java Object. Is it possible to ignore a particular column? Consider following example, I don't want to map column 3 (Address). Please let me know if there is a way to do so. In reality I have more than 10 columns in my CSV that I want to ignore.

Example :- CSV File:

 Header   : Name,Mobile,Address
 Data Row : Rabbit,007,Rabbit Hole

Bindy mapping in Java class:

@CsvRecord(separator = "," , skipFirstLine = true) 
public class Contacts {

@DataField(pos = 1, trim=true)
private String name;

@DataField(pos = 2, required = true, trim=true) 
private Long Mobile;

Thanks for your time!

like image 944
Techie Rabbit Avatar asked Dec 31 '25 04:12

Techie Rabbit


1 Answers

The latest version supports skipField

@CsvRecord(separator = ",",skipField =true)

like image 104
Sarada Chelluboyena Avatar answered Jan 06 '26 05:01

Sarada Chelluboyena



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!