Class JsoEval


  • public class JsoEval
    extends java.lang.Object
    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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object call​(java.lang.Class klass, java.lang.Object obj, java.lang.String methodName, java.lang.Class[] types, java.lang.Object... args)
      Reflectively invokes a method on a JavaScriptObject.
      static java.lang.Object call​(java.lang.Class klass, java.lang.Object obj, java.lang.String methodName, java.lang.Object... args)
      A convenience form of call(Class, Object, String, Class[], Object...) for use directly by users in a debugger.
      static java.lang.Object callEx​(java.lang.Class klass, java.lang.Object obj, java.lang.String methodName, java.lang.Class[] types, java.lang.Object... args)
      Reflectively invokes a method on a JavaScriptObject.
      static java.lang.Object callEx​(java.lang.Class klass, java.lang.Object obj, java.lang.String methodName, java.lang.Object... args)
      A convenience form of call(Class, Object, String, Class[], Object...) for use directly by users in a debugger.
      static java.lang.Object callStatic​(java.lang.Class klass, java.lang.String methodName, java.lang.Class[] types, java.lang.Object... args)
      Reflectively invokes a static method on a JavaScriptObject.
      static java.lang.Object callStaticEx​(java.lang.Class klass, java.lang.String methodName, java.lang.Class[] types, java.lang.Object... args)
      Reflectively invokes a static method on a JavaScriptObject.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • call

        public static java.lang.Object call​(java.lang.Class klass,
                                            java.lang.Object obj,
                                            java.lang.String methodName,
                                            java.lang.Class[] types,
                                            java.lang.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 static
        methodName - The name of the method
        types - The types of the arguments
        args - The values of the arguments
        Returns:
        The result of the method invocation or the failure as a String
      • call

        public static java.lang.Object call​(java.lang.Class klass,
                                            java.lang.Object obj,
                                            java.lang.String methodName,
                                            java.lang.Object... args)
        A convenience form of call(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 of args.
        Returns:
        The result of the method invocation or the failure as a String
      • callEx

        public static java.lang.Object callEx​(java.lang.Class klass,
                                              java.lang.Object obj,
                                              java.lang.String methodName,
                                              java.lang.Class[] types,
                                              java.lang.Object... args)
                                       throws java.lang.ClassNotFoundException,
                                              java.lang.NoSuchMethodException,
                                              java.lang.reflect.InvocationTargetException,
                                              java.lang.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 static
        methodName - The name of the method
        types - The types of the arguments
        args - The values of the arguments
        Returns:
        The result of the method invocation
        Throws:
        java.lang.ClassNotFoundException
        java.lang.NoSuchMethodException
        java.lang.reflect.InvocationTargetException
        java.lang.IllegalAccessException
      • callEx

        public static java.lang.Object callEx​(java.lang.Class klass,
                                              java.lang.Object obj,
                                              java.lang.String methodName,
                                              java.lang.Object... args)
                                       throws java.lang.ClassNotFoundException,
                                              java.lang.NoSuchMethodException,
                                              java.lang.reflect.InvocationTargetException,
                                              java.lang.IllegalAccessException
        A convenience form of call(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 of args.
        Throws:
        java.lang.ClassNotFoundException
        java.lang.NoSuchMethodException
        java.lang.reflect.InvocationTargetException
        java.lang.IllegalAccessException
      • callStatic

        public static java.lang.Object callStatic​(java.lang.Class klass,
                                                  java.lang.String methodName,
                                                  java.lang.Class[] types,
                                                  java.lang.Object... args)
        Reflectively invokes a static method on a JavaScriptObject. Has the same effect as calling call(klass, null, methodName, types, args)
        Returns:
        The result of the method invocation or the failure as a String
      • callStaticEx

        public static java.lang.Object callStaticEx​(java.lang.Class klass,
                                                    java.lang.String methodName,
                                                    java.lang.Class[] types,
                                                    java.lang.Object... args)
                                             throws java.lang.ClassNotFoundException,
                                                    java.lang.NoSuchMethodException,
                                                    java.lang.reflect.InvocationTargetException,
                                                    java.lang.IllegalAccessException
        Reflectively invokes a static method on a JavaScriptObject. Has the same effect as calling call(klass, null, methodName, types, args)
        Throws:
        java.lang.ClassNotFoundException
        java.lang.NoSuchMethodException
        java.lang.reflect.InvocationTargetException
        java.lang.IllegalAccessException