Package com.google.gwt.core.ext.debug
Class JsoEval
java.lang.Object
com.google.gwt.core.ext.debug.JsoEval
Provides facilities for debuggers to call methods on
JavaScriptObjects
.
Because devmode does extensive rewriting of JSO bytecode, debuggers can't
figure out how to evaluate JSO method calls. This class can be used directly
by users to evaluate JSO methods in their debuggers. Additionally, debuggers
with GWT support use this class to transparently evaluate JSO expressions in
breakpoints, watch windows, etc.
Example uses:
JsoEval.call(Element.class, myElement, "getAbsoluteTop");
JsoEval.call(Node.class, myNode, "cloneNode", Boolean.TRUE);
JsoEval.call(Element.class, element.getFirstChildElement(), "setPropertyString", "phase",
"gamma");
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
Reflectively invokes a method on a JavaScriptObject.static Object
A convenience form ofcall(Class, Object, String, Class[], Object...)
for use directly by users in a debugger.static Object
Reflectively invokes a method on a JavaScriptObject.static Object
A convenience form ofcall(Class, Object, String, Class[], Object...)
for use directly by users in a debugger.static Object
callStatic
(Class klass, String methodName, Class[] types, Object... args) Reflectively invokes a static method on a JavaScriptObject.static Object
callStaticEx
(Class klass, String methodName, Class[] types, Object... args) Reflectively invokes a static method on a JavaScriptObject.
-
Method Details
-
call
public static Object call(Class klass, Object obj, String methodName, Class[] types, Object... args) Reflectively invokes a method on a JavaScriptObject.- Parameters:
klass
- Either a class of type JavaScriptObject or an interface implemented by a JavaScriptObject. The class must contain the method to be invoked.obj
- The JavaScriptObject to invoke the method on. Must be null if the method is static. Must be not-null if the method is not staticmethodName
- The name of the methodtypes
- The types of the argumentsargs
- The values of the arguments- Returns:
- The result of the method invocation or the failure as a String
-
call
A convenience form ofcall(Class, Object, String, Class[], Object...)
for use directly by users in a debugger. This method guesses at the types of the method based on the values ofargs
.- Returns:
- The result of the method invocation or the failure as a String
-
callEx
public static Object callEx(Class klass, Object obj, String methodName, Class[] types, Object... args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException Reflectively invokes a method on a JavaScriptObject.- Parameters:
klass
- Either a class of type JavaScriptObject or an interface implemented by a JavaScriptObject. The class must contain the method to be invoked.obj
- The JavaScriptObject to invoke the method on. Must be null if the method is static. Must be not-null if the method is not staticmethodName
- The name of the methodtypes
- The types of the argumentsargs
- The values of the arguments- Returns:
- The result of the method invocation
- Throws:
ClassNotFoundException
NoSuchMethodException
InvocationTargetException
IllegalAccessException
-
callEx
public static Object callEx(Class klass, Object obj, String methodName, Object... args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException A convenience form ofcall(Class, Object, String, Class[], Object...)
for use directly by users in a debugger. This method guesses at the types of the method based on the values ofargs
. -
callStatic
Reflectively invokes a static method on a JavaScriptObject. Has the same effect as callingcall(klass, null, methodName, types, args)
- Returns:
- The result of the method invocation or the failure as a String
-
callStaticEx
public static Object callStaticEx(Class klass, String methodName, Class[] types, Object... args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException Reflectively invokes a static method on a JavaScriptObject. Has the same effect as callingcall(klass, null, methodName, types, args)
-