org.mozilla.javascript
Class NativeJavaConstructor

java.lang.Object
  |
  +--org.mozilla.javascript.ScriptableObject
        |
        +--org.mozilla.javascript.IdScriptable
              |
              +--org.mozilla.javascript.BaseFunction
                    |
                    +--org.mozilla.javascript.NativeFunction
                          |
                          +--org.mozilla.javascript.NativeJavaConstructor
All Implemented Interfaces:
Function, IdFunctionMaster, Scriptable, java.io.Serializable

public class NativeJavaConstructor
extends NativeFunction
implements Function

This class reflects a single Java constructor into the JavaScript environment. It satisfies a request for an overloaded constructor, as introduced in LiveConnect 3. All NativeJavaConstructors behave as JSRef `bound' methods, in that they always construct the same NativeJavaClass regardless of any reparenting that may occur.

Author:
Frank Mitchell
See Also:
NativeJavaMethod, NativeJavaPackage, NativeJavaClass, Serialized Form

Fields inherited from class org.mozilla.javascript.NativeFunction
debug_level, debug_srcName, nestedFunctions
 
Fields inherited from class org.mozilla.javascript.ScriptableObject
DONTENUM, EMPTY, PERMANENT, READONLY
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
NativeJavaConstructor(java.lang.reflect.Constructor ctor)
           
 
Method Summary
 java.lang.Object call(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
          Call the function.
 java.lang.String toString()
           
 
Methods inherited from class org.mozilla.javascript.NativeFunction
decompile, getArity, getLength, jsGet_name
 
Methods inherited from class org.mozilla.javascript.BaseFunction
construct, execMethod, getClassName, getFunctionName, hasInstance, methodArity, setImmunePrototypeProperty
 
Methods inherited from class org.mozilla.javascript.IdScriptable
addAsPrototype, defineProperty, delete, get, getAttributes, has, put, setAttributes
 
Methods inherited from class org.mozilla.javascript.ScriptableObject
callMethod, defineClass, defineClass, defineFunctionProperties, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, get, getAllIds, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, has, hasProperty, hasProperty, isSealed, put, putProperty, putProperty, sealObject, setAttributes, setParentScope, setPrototype
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mozilla.javascript.Function
construct
 
Methods inherited from interface org.mozilla.javascript.Scriptable
delete, delete, get, get, getClassName, getDefaultValue, getIds, getParentScope, getPrototype, has, has, hasInstance, put, put, setParentScope, setPrototype
 

Constructor Detail

NativeJavaConstructor

public NativeJavaConstructor(java.lang.reflect.Constructor ctor)
Method Detail

call

public java.lang.Object call(Context cx,
                             Scriptable scope,
                             Scriptable thisObj,
                             java.lang.Object[] args)
                      throws JavaScriptException
Description copied from interface: Function
Call the function. Note that the array of arguments is not guaranteed to have length greater than 0.
Specified by:
call in interface Function
Overrides:
call in class BaseFunction
Following copied from interface: org.mozilla.javascript.Function
Parameters:
cx - the current Context for this thread
scope - the scope to execute the function relative to. This is set to the value returned by getParentScope() except when the function is called from a closure.
thisObj - the JavaScript this object
args - the array of arguments
Returns:
the result of the call
Throws:
JavaScriptException - if an uncaught exception occurred while executing the function

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object