35 /**
36 * <p>
37 * Allows Java code to manipulate JavaScript objects.
38 * </p>
39 *
40 * <p>
41 * When a JavaScript object is passed or returned to Java code, it
42 * is wrapped in an instance of {@code JSObject}. When a
43 * {@code JSObject} instance is passed to the JavaScript engine,
44 * it is unwrapped back to its original JavaScript object. The
45 * {@code JSObject} class provides a way to invoke JavaScript
46 * methods and examine JavaScript properties.
47 * </p>
48 *
49 * <p> Any data returned from the JavaScript engine to Java is
50 * converted to Java data types. Certain data passed to the JavaScript
51 * engine is converted to JavaScript data types.
52 * </p>
53 *
54 */
55 public abstract class JSObject {
56 /**
57 * Constructs a new JSObject. Users should neither call this method nor
58 * subclass JSObject.
59 */
60 protected JSObject() {
61 }
62
63 /**
64 * Calls a JavaScript method. Equivalent to
65 * "this.methodName(args[0], args[1], ...)" in JavaScript.
66 *
67 * @param methodName The name of the JavaScript method to be invoked.
68 * @param args the Java objects passed as arguments to the method.
69 * @return Result of the method.
70 * @throws JSException when an error is reported from the browser or
71 * JavaScript engine.
72 */
73 public abstract Object call(String methodName, Object... args) throws JSException;
74
|
35 /**
36 * <p>
37 * Allows Java code to manipulate JavaScript objects.
38 * </p>
39 *
40 * <p>
41 * When a JavaScript object is passed or returned to Java code, it
42 * is wrapped in an instance of {@code JSObject}. When a
43 * {@code JSObject} instance is passed to the JavaScript engine,
44 * it is unwrapped back to its original JavaScript object. The
45 * {@code JSObject} class provides a way to invoke JavaScript
46 * methods and examine JavaScript properties.
47 * </p>
48 *
49 * <p> Any data returned from the JavaScript engine to Java is
50 * converted to Java data types. Certain data passed to the JavaScript
51 * engine is converted to JavaScript data types.
52 * </p>
53 *
54 */
55 @SuppressWarnings("deprecation")
56 public abstract class JSObject {
57 /**
58 * Constructs a new JSObject. Users should neither call this method nor
59 * subclass JSObject.
60 */
61 protected JSObject() {
62 }
63
64 /**
65 * Calls a JavaScript method. Equivalent to
66 * "this.methodName(args[0], args[1], ...)" in JavaScript.
67 *
68 * @param methodName The name of the JavaScript method to be invoked.
69 * @param args the Java objects passed as arguments to the method.
70 * @return Result of the method.
71 * @throws JSException when an error is reported from the browser or
72 * JavaScript engine.
73 */
74 public abstract Object call(String methodName, Object... args) throws JSException;
75
|