42BV / CSVeed

Light-weight, easy-to-use Java-based CSV utility
Apache License 2.0
100 stars 22 forks source link

Implement ability to verify required fields #8

Closed robert-bor closed 11 years ago

robert-bor commented 11 years ago

Bean properties that are set to be required will not be allowed null or empty values.

An error will be thrown when a property is not set as such, with a tracer back to the original line + cell position.

Assume the following CSV:

name;street;city
Jim;Highway;New York
Anne;;Chicago

And a matching Bean with an annotated property "street":

@CsvCell(required = true)
private String street;

The following error is expected:

Property "street" may not be null or empty. Error found in column "street".
Anne;;Chicago
     ^