• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reflection : Using getDeclaredMethod without method arguments  RSS feed

 
Karthik Vijayarajan
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am using the reflection API for the first time. Looks very interesting and it solves a complex problem for me
I am trying to get access to a method(method has no args). I find some difficulty in using the getDeclaredMethod. The signature of this method is


My method doesnt have any arguments and hence i couldnt use getDeclaredMethod. I assume there would be a way to get method names that do not have arguments.
Can someone please throw some light on this? Thanks.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a while since I've used Reflection, but have you tried passing either null or a zero length array i.e.


That would be the first thing I tried.
 
Karthik Vijayarajan
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had tried before by passing null as an argument(but also did something stupid -forgot to uncomment some code ) and it failed..

I corrected my code and passed null. It works great.
Thanks a lot.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!