nashorn/src/netscape/javascript/JSObject.java
author lana
Wed, 17 Apr 2013 10:31:01 -0700
changeset 16977 aa655625a6b9
parent 16151 97c1e756ae1e
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     1
/*
16151
97c1e756ae1e 8005663: Update copyright year to 2013
jlaskey
parents: 16147
diff changeset
     2
 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     4
 *
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    10
 *
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    15
 * accompanied this code).
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    16
 *
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    20
 *
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    23
 * questions.
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    24
 */
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    25
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    26
package netscape.javascript;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    27
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    28
import java.applet.Applet;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    29
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    30
/**
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    31
 * Stub for JSObject to get compilation going.
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    32
 */
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    33
public abstract class JSObject {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    34
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    35
    /**
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    36
     * Get the window for an {@link Applet}. Not supported
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    37
     * by Nashorn
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    38
     *
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    39
     * @param a applet
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    40
     * @return the window instance
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    41
     */
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    42
    public static JSObject getWindow(final Applet a) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    43
        throw new UnsupportedOperationException("getWindow");
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    44
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    45
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    46
    /**
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    47
     * Call a JavaScript method
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    48
     *
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    49
     * @param methodName name of method
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    50
     * @param args arguments to method
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    51
     * @return result of call
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    52
     */
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    53
    public abstract Object call(String methodName, Object args[]);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    54
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    55
    /**
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    56
     * Evaluate a JavaScript expression
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    57
     *
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    58
     * @param s JavaScript expression to evaluate
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    59
     * @return evaluation result
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    60
     */
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    61
    public abstract Object eval(String s);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    62
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    63
    /**
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    64
     * Retrieves a named member of a JavaScript object.
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    65
     *
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    66
     * @param name of member
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    67
     * @return member
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    68
     */
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    69
    public abstract Object getMember(String name);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    70
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    71
    /**
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    72
     * Retrieves an indexed member of a JavaScript object.
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    73
     *
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    74
     * @param index index of member slot
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    75
     * @return member
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    76
     */
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    77
    public abstract Object getSlot(int index);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    78
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    79
    /**
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    80
     * Remove a named member from a JavaScript object
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    81
     *
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    82
     * @param name name of member
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    83
     */
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    84
    public abstract void removeMember(String name);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    85
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    86
    /**
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    87
     * Set a named member in a JavaScript object
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    88
     *
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    89
     * @param name  name of member
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    90
     * @param value value of member
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    91
     */
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    92
    public abstract void setMember(String name, Object value);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    93
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    94
    /**
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    95
     * Set an indexed member in a JavaScript object
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    96
     *
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    97
     * @param index index of member slot
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    98
     * @param value value of member
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    99
     */
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   100
    public abstract void setSlot(int index, Object value);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   101
}