My requirement is that I am having a class Employee as:-
class Employee {
private String firstName;
}
Under some conditions I want to add two more fields dynamically to Employee class, let say lastName and middleName. The option is certainly using reflection. That is later part. The doubt is:-
As the code is going to be used in web application. So, as per my understanding, per request as per the above logic, a new class will be formed and loaded by the class loader?
If yes, then there would be lot of classes in JVM. Am I right?
I get from some hyperlinks about the approach Java: dynamic properties and add property for a object dynamicly.
But I want to calculate the implications first.
Aucun commentaire:
Enregistrer un commentaire