title: Java: is it possible to add attributes dynamically?
body: <p>I know that is not the best solution but I need to add attributes (and relative methods get/set) on a class dynamically: each time the attribute names (and values of course) must be differents.
  <br>
  Why? Simple.</p>
  
  <p>I have to use a class to print some CSV, (CsvBuilderService). <br></p>
  
  <p>This class is initialized taking another class: <br></p>
  
  <pre><code>CSVBuilderService&lt;DTO&gt; builder = new CSVBuilderService&lt;DTO&gt;();
  </code></pre>
  
  <p>Now the CSVBuilderService is initialized to print a list of DTO, the attribute names of DTO are used as columns and the values as rows.</p>
  
  <p>The problem is: the DTO format can change every time, different column names and a different number of columns. (they are query results from different tables each time).</p>
  
  <p>So, I have to add dynamically each time a different number of attributes to DTO with different names, someone has an idea to achieve this?</p>
  
  <p>I didn't search another method to make the CSV since i must use CsvBuilder, i can't use any other methods.</p>