• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Reflection(URGENT)

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can somebody please tell me that how can I get the protected and private methods of a class through reflection API.
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Method extends AccessibleObject so you should be able to use

There is a brief discussion here in the section "Security Model".
Perhaps Im being naive, but I would think that if you want to use a private method, either you can just use this.whatever() -- no need for reflection. Or you should change the access modifier.
And more or less the same for protected methods -- I think what Im saying is that although you can do it, you shouldnt have to.
James
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course you have to have a proper policy file for being able to execute this method.

Peter.
 
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is a "policy file" ? I don't see a reference to this in the Reflection API documentation.
 
Anirban dutta
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi james,
Please don't get emotional with the concept of OOPS . I am in no way thinking of using the private methods. Just I wanted to know out of curiosity that is it possible through Reflection and if yes then how?
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then what the heck was so URGENT about it?? :roll:
 
Anirban dutta
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Respected cindy,
again u bot senti with the things. Isn't doubt clearance a urgent thing, for me it's so, but if it's something else for you, then I am extremely sorry for putting the URGENT thing
REGARDS
 
Poop goes in a willow feeder. Wipe with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic