2003/11/13 05:04:22
[org.ibex.core.git] / src / org / xwt / js / JSCallable.java
1 package org.xwt.js;
2
3 /** anything that is callable with the () operator and wasn't compiled from JS code */
4 public abstract class JSCallable extends JSObj {
5     public Object call0(Object method) throws JS.Exn {
6         JSArray args = new JSArray();
7         return call(method, args);
8     }
9     public Object call1(Object method, Object arg1) throws JS.Exn {
10         JSArray args = new JSArray();
11         args.addElement(arg1);
12         return call(method, args);
13     }
14     public Object call2(Object method, Object arg1, Object arg2) throws JS.Exn {
15         JSArray args = new JSArray();
16         args.addElement(arg1);
17         args.addElement(arg2);
18         return call(method, args);
19     }
20     public Object call(Object method, JSArray args) throws JS.Exn {
21         throw new JS.Exn("cannot invoke this method with " + args.size() + " arguments");
22     }
23 }
24