File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Doubt in Reflection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Doubt in Reflection" Watch "Doubt in Reflection" New topic
Author

Doubt in Reflection

Thennam Pandian
Ranch Hand

Joined: Oct 11, 2005
Posts: 163
Hi,

How can I find the Calling Methos using reflection.


thanks,
Thennam
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
I don't think that is done via reflection. Look at the Thread class, for how to get the stack trace.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38763
    
  23
Do you mean you have a method which wants to know which method has invoked it?

I don't think that you are actually supposed to do that; the idea of a supplier class with public methods is that it is available to all objects without prejudice and without knowing whom it is serving. Bit like a bus; anybody can travel as long as they pay for their ticket, without the driver asking their name!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in Reflection