|
Java™ by example!
|
|
|
How do I find out what method from what class invoked the method that is currently running?
You may want to look into examining stack traces. Eg. Consider following example: Main.java:
outputs:
You can write a utility class that parses this information and return it to you in a more useful manner. I remember reading an article about examining stack traces, with such a utility class, but can't find it. I think it was on DDJ, but not sure. Please post it here as a comment if you spot it.
Further Information
Author of answer: Joris Van den Bogaert
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|