• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting the method name that you are currently in.

 
Dale DeMott
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way for an object to get the current method name that the object is in?
-Dale
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JDK 1.4+ you can use Throwable.getStackTrace()
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"the current method name that the object is in"
What does that mean? The OBJECT is not in any method, it is on the heap. There are one or more variables out there that hold a reference to that object.
Unless you are asking how to find out what method that a local variable is declared in that holds a reference to that object???
Or maybe you are asking at a particular moment in time what other object is manipulating this object in using what method??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic