Subj : Rhino question: multiple constructors in scriptable objects To : netscape.public.mozilla.jseng From : mesuti@aciworldwide.com Date : Mon Mar 01 2004 01:59 pm Hi, Is it possible to define a subclass of ScriptableObject that contains multiple constructors (jsConstructor() methods). I want to define a class called "ByteBuffer" extending the Scriptable Object and instantiate it in JavaScript using different constructors. Example Class: public class ByteBuffer extends ScriptableObject { public ByteBuffer() { } public void jsConstructor() { } public void jsConstructor(String value, int encoding) { } public void jsConstructor(ByteString source) { } public String getClassName() { return "ByteBuffer"; } } The 'ByteString' object (see example above) is also a subclass of ScriptableObject. I know that it's not allowed to define multiple methods called 'jsConstructor'. My question is how can I define a Host-Object which I can instantiate it in JavaScript with different constructor signatures? i.e. var obj1 = new ByteBuffer(); var obj2 = new ByteBuffer("a string", 2); var obj3 = new ByteBuffer(new ByteString("another string", 2)); Thanks, Ishak Mesut .