title: Java Parse String in Class Instance
body: <p>i want parse a String into a Class Instance.
  My Data come from a .csv.</p>
  <p>Code:</p>
  <pre><code>@Override
  public List&lt;Strasse&gt; getByStadtId(Stadt stadtId){
      return repo.findByStadtId(stadtId);
  }
  
  @Override
  public void saveStrassenData() {
      StringBuilder builder = new StringBuilder();
      try {
          BufferedReader bufferReader = new BufferedReader(new FileReader(&quot;src/main/resources/csv/strassen.csv&quot;));
          while((line = bufferReader.readLine()) != null) {
              String [] data=line.split(&quot;,&quot;);
              Strasse strasse = new Strasse();
              Stadt stadt = new Stadt();
              strasse.setId(Long.parseLong(data[0]));
              strasse.setName(data[1]);
              strasse.setVerwaltungsKuerzel(data[2]);
              strasse.setStadt(data[3]);
              repo.save(strasse);
          } 
      
      }
      catch (IOException e) {
          //TODO Auto-generated catch block
          e.printStackTrace();
      }
  }
  </code></pre>
  <p>In Picture 1 you can see my error.</p>
  <p><a href="https://i.stack.imgur.com/swMyA.png" rel="nofollow noreferrer">Picture of the Code</a></p>
  <p>My Class is in the pictures:</p>
  <p><a href="https://i.stack.imgur.com/ZF0NJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZF0NJ.png" alt="enter image description here" /></a></p>
  <p>The .csv</p>
  <p><a href="https://i.stack.imgur.com/dMvLT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dMvLT.png" alt="enter image description here" /></a></p>