David Morón's Blog
Stuff that needs to be said.
Wednesday, November 14, 2007
How can I find what class or method is calling this method? Java
To do it, use this wherever you need to know who is calling the current method:
{..
String className = new Throwable().getStackTrace()[1].getClassName();
String methodName = new Throwable().getStackTrace()[1].getMethodName();
..}
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)