Yap4j (Yet Another Java Parser For Java) was born after I spent a long frastruting couple of days experimenting with library after library to accomplish the simple task of parsing a CSV (Comma Seaprated Value) file.
I struggled with various libaries from Apache's Commons CSV, which claims to unify and provide a common and simple interface with contributions from Skife CSV, Open CSV, and Genjava CSV, to Super CSV, which is probably the most usable and documented of all.
Like any programmer with some free bandwidth, I decided to write my own and open-source it with the hope that nobody would have to go through what I went through over the most trival of tasks.
Enjoy and Fork!
Include the following dependency in your POM file:
<dependency> <groupId>com.polymathiccoder</groupId> <artifactId>yap4j</artifactId> <version>0.1.0</version> </dependency>
Attribute | Description | Required | Default |
---|---|---|---|
fileName | The name and path to the CSV file | Yes | N/A |
delimiter | Record delimiters in the CSV file | No | Comma ( , ) |
noHeader | determines wether the CSV has a header line or not | No | False |
Attribute | Description | Required | Default |
---|---|---|---|
header | The name of the corresponding record header in the CSV file | Only if the noHeader attribute of @CsvFile is false | N/A |
position | The position of the corresponding record in the CSV file | Only if the noHeader attribute of @CsvFile is true | N/A |
format | Determines how certain temporal types are formated in the CSV record such as java.util.Date and org.joda.time.Period | Only if the field to-be-mapped-to is temporal | Empty String |
optional | Determines whether the field is optional in the CSV file or not | No | False |
ignore | Determines whether the mapping be ignored or not | No | False |
defaultValue | Determines the default value to be set if the record is empty in the CSV file | Only if the field to-be-mapped-to is primitive | Empty String |
PolymathicCoder (abdelmonaim.remani@gmail.com)
Abdelmonaim Remani (abdelmonaim.remani@gmail.com)
You can download this project in either zip or tar formats.
You can also clone the project with Git by running:
$ git clone git://github.com/PolymathicCoder/Yap4j