File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Genric CSV generator with field names in Prop/Map Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Genric CSV generator with field names in Prop/Map" Watch "Genric CSV generator with field names in Prop/Map" New topic

Genric CSV generator with field names in Prop/Map

Vijay Kumar koganti
Ranch Hand

Joined: Jan 23, 2006
Posts: 53
Hi all,

I am planning to write a generic CSV generator method that would take ObjectList and Map/properties file with all the pojo fields info. The method then has to
create a csv file by iterating through the list of objects and based on the Map/Properties file fetch all the field values(Fields are defined in the Properties file)
for each of object and create csv file at the end.
For Ex:
1. List of Employee Pojo Objects
2. Properties file with some of the fields from Employee pojo say EmpName,EmpID
3. Resultant CSV file :

What i am looking for is some pointers on what is the best way to do it and is there some thing that is readily available opensource that i can use/extend it.I wanted
to follow this approach so that if tomorrow some new fields has to be added i dont have to touch my code just update my properties file and it should work.


vijay kumar k.
Lester Burnham

Joined: Oct 14, 2008
Posts: 1337
The page lists several CSV-generating libraries. CSVBeans in particular sounds as if it does something like what you propose.
subject: Genric CSV generator with field names in Prop/Map
Similar Threads
Need a framework for mapping/populate Domain Objects(POJOs) to Transfer Objects(also POJO)
POJO implements Serializable - Why ???
how to print objects from linked list?
Toplink One Class From Two Seperate Table
List of Maps backed form in Struts 1