Menu

#10 Expose the current record type

open
nobody
None
5
2009-07-27
2009-07-27
No

When parsing the DataSet, the record type must obviously be known internally. However it is not exposed externally, so the client code must check a set of record types manually. See the Camel Flatpack code below which is hard coded to check "header" and "trailer". This would be simplified, if it the record type was exposed.

http://fisheye6.atlassian.com/browse/camel/trunk/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/FlatpackConverter.java?r=HEAD

boolean header = dataSet.isRecordID(FlatpackComponent.HEADER_ID);
boolean trailer = dataSet.isRecordID(FlatpackComponent.TRAILER_ID);

// the columns can vary depending on header, body or trailer
String[] columns;
if (header) {
columns = dataSet.getColumns(FlatpackComponent.HEADER_ID);
} else if (trailer) {
columns = dataSet.getColumns(FlatpackComponent.TRAILER_ID);
} else {
columns = dataSet.getColumns();
}

Discussion


Log in to post a comment.