0

Currently i'm trying to map a csv to a java object.

The headers should be:

CID,CName,SID,SName,Country,Street,StreetNumber,ZipCode,Number,IP,type,isAdmin

The actual CSV has no headers and looks like this:

1,RINT,00001,Foo,Bar,Street,1,1010,1,10.1.2.1,typeR,1
1,RINT,00001,Foo,Bar,Street,1,1010,2,10.1.2.2,typeL,0
1,RINT,00001,Foo,Bar,Street,1,1010,3,10.1.2.3,typeL,0
1,RINT,00001,Foo,Bar,Street,1,1010,4,10.1.2.4,typeL,0
2,RANT,00002,Foo,Bar,Street,2,1011,1,10.1.2.1,typeR,1
2,RANT,00002,Foo,Bar,Street,2,1011,2,10.1.2.2,typeL,0
2,RANT,00002,Foo,Bar,Street,2,1011,3,10.1.2.3,typeL,0
2,RANT,00002,Foo,Bar,Street,2,1011,4,10.1.2.4,typeL,0

While i have found out that i could map this with this. Ofc I'd first need a class called Sessions which looks like the csv sheet???

public class Sessions(){
  private integer cId;
  private String cName;
  private integer sId;
  private String sName;
  ....
}

I am a bit confused about how to get the data from the object to further process it (like: display in a GUI to let me select certain data and write putty sessions with this information -> .reg files OR .txt files).

The amount of sessions (each csv row) i have right now is around 1000 - 2000 and growing. They are exported via a trigger out of a database and then should be further processed by a java program (that i'm writing) to manage the amount of sessions for putty.

So how do i "read" the data from that Object (Session.class) again? Maybe im just dumb right now.

dEEkAy
  • 23
  • 4
  • When you look at the thread you found, you see that it works with a `List`of `Session`. So you can iterate over the elements of the list. – IQV Feb 09 '18 at 08:58
  • So i was blind indeed. Thanks for pointing that out =). I solved my issued with and created a corresponding PuttySession class which contains the needed fields. `Map> allPuttySession = new HashMap>();` – dEEkAy Feb 12 '18 at 07:39

0 Answers0