nashorn/src/netscape/javascript/JSObject.java
changeset 18011 05a7d1f1746a
parent 18010 604faee85350
parent 17815 b72ae39e1329
child 18012 03261c9bd428
equal deleted inserted replaced
18010:604faee85350 18011:05a7d1f1746a
     1 /*
       
     2  * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
       
     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 
       
    26 package netscape.javascript;
       
    27 
       
    28 import java.applet.Applet;
       
    29 
       
    30 /**
       
    31  * Stub for JSObject to get compilation going.
       
    32  */
       
    33 public abstract class JSObject {
       
    34 
       
    35     /**
       
    36      * Get the window for an {@link Applet}. Not supported
       
    37      * by Nashorn
       
    38      *
       
    39      * @param a applet
       
    40      * @return the window instance
       
    41      */
       
    42     public static JSObject getWindow(final Applet a) {
       
    43         throw new UnsupportedOperationException("getWindow");
       
    44     }
       
    45 
       
    46     /**
       
    47      * Call a JavaScript method
       
    48      *
       
    49      * @param methodName name of method
       
    50      * @param args arguments to method
       
    51      * @return result of call
       
    52      */
       
    53     public abstract Object call(String methodName, Object args[]);
       
    54 
       
    55     /**
       
    56      * Evaluate a JavaScript expression
       
    57      *
       
    58      * @param s JavaScript expression to evaluate
       
    59      * @return evaluation result
       
    60      */
       
    61     public abstract Object eval(String s);
       
    62 
       
    63     /**
       
    64      * Retrieves a named member of a JavaScript object.
       
    65      *
       
    66      * @param name of member
       
    67      * @return member
       
    68      */
       
    69     public abstract Object getMember(String name);
       
    70 
       
    71     /**
       
    72      * Retrieves an indexed member of a JavaScript object.
       
    73      *
       
    74      * @param index index of member slot
       
    75      * @return member
       
    76      */
       
    77     public abstract Object getSlot(int index);
       
    78 
       
    79     /**
       
    80      * Remove a named member from a JavaScript object
       
    81      *
       
    82      * @param name name of member
       
    83      */
       
    84     public abstract void removeMember(String name);
       
    85 
       
    86     /**
       
    87      * Set a named member in a JavaScript object
       
    88      *
       
    89      * @param name  name of member
       
    90      * @param value value of member
       
    91      */
       
    92     public abstract void setMember(String name, Object value);
       
    93 
       
    94     /**
       
    95      * Set an indexed member in a JavaScript object
       
    96      *
       
    97      * @param index index of member slot
       
    98      * @param value value of member
       
    99      */
       
   100     public abstract void setSlot(int index, Object value);
       
   101 }