Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

getting only getters - Reflection  RSS feed

 
Em Aiy
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am making a class and overloading "toString()" method. In which i am appending all the properties in particular format. Now i am using Reflection to get all the methods then traversing in a loop and appending it, it work fine but it also includes the methods which are not "GETTERS" so create problem. Is there any way to get on getters using reflection?
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check whether the name of the method starts with get.
 
Em Aiy
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for reply, i already figured out doing it in that way. thanks again
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!