Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Generic Getter and Setters

807589Nov 18 2008 — edited Nov 19 2008
Hi all,

I want to dynamically access getter and setter methods depending on the variables i have

suppose i have a variable

String checkGetter;

and a getter method
public String getCheckGetter(){return this.checkGetter;}

and in addition to that some more variables and their getters and setters

and i want to access all the getter/setter methods dynamically ,if i am having only the variable name(as a String). I dont want to add code for accessing these methods, instead put in a loop and do my work.

Can one achieve this in Java.


Thanks in advance.

Regards.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 17 2008
Added on Nov 18 2008
9 comments
269 views