sexta-feira, 15 de janeiro de 2016

QuickPost: Object to CSV using Java 8

In a personal application I wanted to transform a few classes to CSV format without having to use external libraries. I used Java 8 and it is working very well for me so I thought about share the class in this post.

It basically goes through the fields of a given class from a List and creates the CSV. The same case could be applied for XML, JSON and other formats, but in my case I only needed CSV. The original version had only a few lines, but I increased it to include a few configuration fields.

See the class and a simply JUnit test for it. The source code of the maven project is also in my github.

Nenhum comentário:

Postar um comentário