• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Reflection : Using getDeclaredMethod without method arguments  RSS feed

 
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.
 
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!