< prev index next >

src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/JSObject.java

Print this page




  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 jdk.nashorn.api.scripting;
  27 
  28 import java.util.Collection;
  29 import java.util.Set;
  30 import jdk.nashorn.internal.runtime.JSType;
  31 
  32 /**
  33  * This interface can be implemented by an arbitrary Java class. Nashorn will
  34  * treat objects of such classes just like nashorn script objects. Usual nashorn
  35  * operations like obj[i], obj.foo, obj.func(), delete obj.foo will be delegated
  36  * to appropriate method call of this interface.
  37  *



  38  * @since 1.8u40
  39  */

  40 public interface JSObject {
  41     /**
  42      * Call this object as a JavaScript function. This is equivalent to
  43      * 'func.apply(thiz, args)' in JavaScript.
  44      *
  45      * @param thiz 'this' object to be passed to the function. This may be null.
  46      * @param args arguments to method
  47      * @return result of call
  48      */
  49     public Object call(final Object thiz, final Object... args);
  50 
  51     /**
  52      * Call this 'constructor' JavaScript function to create a new object.
  53      * This is equivalent to 'new func(arg1, arg2...)' in JavaScript.
  54      *
  55      * @param args arguments to method
  56      * @return result of constructor call
  57      */
  58     public Object newObject(final Object... args);
  59 




  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 jdk.nashorn.api.scripting;
  27 
  28 import java.util.Collection;
  29 import java.util.Set;
  30 import jdk.nashorn.internal.runtime.JSType;
  31 
  32 /**
  33  * This interface can be implemented by an arbitrary Java class. Nashorn will
  34  * treat objects of such classes just like nashorn script objects. Usual nashorn
  35  * operations like obj[i], obj.foo, obj.func(), delete obj.foo will be delegated
  36  * to appropriate method call of this interface.
  37  *
  38  * @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool 
  39  * are deprecated with the intent to remove them in a future release.
  40  *
  41  * @since 1.8u40
  42  */
  43 @Deprecated(since="11", forRemoval=true)
  44 public interface JSObject {
  45     /**
  46      * Call this object as a JavaScript function. This is equivalent to
  47      * 'func.apply(thiz, args)' in JavaScript.
  48      *
  49      * @param thiz 'this' object to be passed to the function. This may be null.
  50      * @param args arguments to method
  51      * @return result of call
  52      */
  53     public Object call(final Object thiz, final Object... args);
  54 
  55     /**
  56      * Call this 'constructor' JavaScript function to create a new object.
  57      * This is equivalent to 'new func(arg1, arg2...)' in JavaScript.
  58      *
  59      * @param args arguments to method
  60      * @return result of constructor call
  61      */
  62     public Object newObject(final Object... args);
  63 


< prev index next >