How to add class fields dynamically at runtime in Java
Possible duplicate:
How to dynamically add properties to a class
I would like to know if they can somehow add fields to the entity class in Java, dynamically or their alternative way to do it? We are developing a structure and our existing products have this as a requirement.
Example:
class Entity1 {
String name;
String age;
// Getters/setters;
}
Suppose I want to add another field to my class Entity1
(eg :) designation
, is this their way to add it dynamically / at runtime, so if my client asks me to add any other properties, can I do it with less code change?
Waiting for an answer. Any suggestions are greatly appreciated.
+3
source to share