Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know the caller class of a function

Tags:

java

gwt

Hello is there a way to know the caller class name of a function, specifically for a Java-GWT application?

like image 251
quarks Avatar asked Jan 23 '12 09:01

quarks


1 Answers

Thread.currentThread is not supported in GWT (remember that java code gets compiled to javascript), so this is a possible duplicate of:

How do you find out the caller function in JavaScript?

In GWT you'd simply write a jsni wrapper:

public static native void whosMyCaller() /*-{
    $wnd.alert(arguments.callee.caller.toString());
}-*/;
like image 121
milan Avatar answered Oct 17 '22 05:10

milan