How to dynamically add class fields at runtime in Java
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/14442998/how-to-dynamically-add-properties-to-class">How to dynamically add properties to class</a>  </p>
</blockquote>



<p>I would like to know is their any way to add fields to my entity class in Java, dynamically, or is their any alternative way of doing this? We are developing a framework and our existing products has this as a requirement.</p>

<p>Example:</p>

<pre><code>class Entity1 {
    String name;
    String age;

    // Getters/setters;
}
</code></pre>

<p>Suppose I want to add another field to my <code>Entity1</code> class (eg: <code>designation</code>), is their any way to add it dynamically/at runtime, so that if my client asks me to add any other properties I can do it with less alteration of code?</p>

<p>Waiting for your reply. Any suggestions are welcome.</p>
