Bindy - Apache Camel. Can a position (column) be ignored while unmarshaling CSV? -
i using camel-bindy unmarshall csv java object. possible ignore particular column? consider following example, don't want map column 3 (address). please let me know if there way so. in reality have more 10 columns in csv want 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 time!
you cannot skip column. bindy iterates through every token , checks if there associated data field, see bindycsvfactory:
// datafield model datafield datafield = datafields.get(pos); objecthelper.notnull(datafield, "no position " + pos + " defined field: " + data + ", line: " + line);
the solution define class attribute ignored:
@datafield(pos = 1) public string ingoreme;
Comments
Post a Comment