author | sundar |
Mon, 24 Jun 2013 19:06:01 +0530 | |
changeset 18614 | addca7a10167 |
parent 17751 | 15a93d511eb7 |
child 19889 | 63af9358d0dc |
permissions | -rw-r--r-- |
16147 | 1 |
/* |
16151 | 2 |
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
16147 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
17751
15a93d511eb7
8009141: Avoid netscape.javascript.JSObject in nashorn code
sundar
parents:
16151
diff
changeset
|
26 |
package jdk.nashorn.api.scripting; |
16147 | 27 |
|
28 |
/** |
|
17751
15a93d511eb7
8009141: Avoid netscape.javascript.JSObject in nashorn code
sundar
parents:
16151
diff
changeset
|
29 |
* netscape.javascript.JSObject-like interface for nashorn script objects. |
16147 | 30 |
*/ |
31 |
public abstract class JSObject { |
|
32 |
/** |
|
18614 | 33 |
* Call a JavaScript function |
16147 | 34 |
* |
18614 | 35 |
* @param functionName name of function |
16147 | 36 |
* @param args arguments to method |
37 |
* @return result of call |
|
38 |
*/ |
|
18614 | 39 |
public abstract Object call(String functionName, Object... args); |
40 |
||
41 |
/** |
|
42 |
* Call a JavaScript method as a constructor. This is equivalent to |
|
43 |
* calling new obj.Method(arg1, arg2...) in JavaScript. |
|
44 |
* |
|
45 |
* @param functionName name of function |
|
46 |
* @param args arguments to method |
|
47 |
* @return result of constructor call |
|
48 |
*/ |
|
49 |
public abstract Object newObject(String functionName, Object... args); |
|
16147 | 50 |
|
51 |
/** |
|
52 |
* Evaluate a JavaScript expression |
|
53 |
* |
|
54 |
* @param s JavaScript expression to evaluate |
|
55 |
* @return evaluation result |
|
56 |
*/ |
|
57 |
public abstract Object eval(String s); |
|
58 |
||
59 |
/** |
|
60 |
* Retrieves a named member of a JavaScript object. |
|
61 |
* |
|
62 |
* @param name of member |
|
63 |
* @return member |
|
64 |
*/ |
|
65 |
public abstract Object getMember(String name); |
|
66 |
||
67 |
/** |
|
68 |
* Retrieves an indexed member of a JavaScript object. |
|
69 |
* |
|
70 |
* @param index index of member slot |
|
71 |
* @return member |
|
72 |
*/ |
|
73 |
public abstract Object getSlot(int index); |
|
74 |
||
75 |
/** |
|
76 |
* Remove a named member from a JavaScript object |
|
77 |
* |
|
78 |
* @param name name of member |
|
79 |
*/ |
|
80 |
public abstract void removeMember(String name); |
|
81 |
||
82 |
/** |
|
83 |
* Set a named member in a JavaScript object |
|
84 |
* |
|
85 |
* @param name name of member |
|
86 |
* @param value value of member |
|
87 |
*/ |
|
88 |
public abstract void setMember(String name, Object value); |
|
89 |
||
90 |
/** |
|
91 |
* Set an indexed member in a JavaScript object |
|
92 |
* |
|
93 |
* @param index index of member slot |
|
94 |
* @param value value of member |
|
95 |
*/ |
|
96 |
public abstract void setSlot(int index, Object value); |
|
97 |
} |