org.mozilla.javascript
Class IdFunction
java.lang.Object
|
+--org.mozilla.javascript.ScriptableObject
|
+--org.mozilla.javascript.IdScriptable
|
+--org.mozilla.javascript.BaseFunction
|
+--org.mozilla.javascript.IdFunction
- All Implemented Interfaces:
- Function, IdFunctionMaster, Scriptable, java.io.Serializable
- public class IdFunction
- extends BaseFunction
- See Also:
- Serialized Form
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, getTopLevelScope, has, hasProperty, hasProperty, isSealed, put, putProperty, putProperty, sealObject, setAttributes, setParentScope, setPrototype |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.mozilla.javascript.Scriptable |
delete, delete, get, get, getDefaultValue, getIds, getParentScope, has, has, put, put, setParentScope, setPrototype |
FUNCTION_ONLY
public static final int FUNCTION_ONLY
CONSTRUCTOR_ONLY
public static final int CONSTRUCTOR_ONLY
FUNCTION_AND_CONSTRUCTOR
public static final int FUNCTION_AND_CONSTRUCTOR
IdFunction
public IdFunction(IdFunctionMaster master,
java.lang.String name,
int id)
functionType
public final int functionType()
setFunctionType
public void setFunctionType(int type)
getPrototype
public Scriptable getPrototype()
- Description copied from interface:
Scriptable
- Get the prototype of the object.
- Overrides:
getPrototype
in class ScriptableObject
- Following copied from interface:
org.mozilla.javascript.Scriptable
- Returns:
- the prototype
call
public java.lang.Object call(Context cx,
Scriptable scope,
Scriptable thisObj,
java.lang.Object[] args)
throws JavaScriptException
- Description copied from class:
BaseFunction
- Should be overridden.
- Overrides:
call
in class BaseFunction
- Following copied from interface:
org.mozilla.javascript.Function
- Parameters:
cx
- the current Context for this threadscope
- 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
objectargs
- the array of arguments- Returns:
- the result of the call
- Throws:
JavaScriptException
- if an uncaught exception
occurred while executing the function
construct
public Scriptable construct(Context cx,
Scriptable scope,
java.lang.Object[] args)
throws JavaScriptException
- Description copied from interface:
Function
- Call the function as a constructor.
This method is invoked by the runtime in order to satisfy a use
of the JavaScript
new
operator. This method is
expected to create a new object and return it.
- Overrides:
construct
in class BaseFunction
- Following copied from interface:
org.mozilla.javascript.Function
- Parameters:
cx
- the current Context for this threadscope
- an enclosing scope of the caller except
when the function is called from a closure.args
- the array of arguments- Returns:
- the allocated object
- Throws:
JavaScriptException
- if an uncaught exception
occurred while executing the constructor
decompile
public java.lang.String decompile(Context cx,
int indent,
boolean justbody)
- Description copied from class:
BaseFunction
- Decompile the source information associated with this js
function/script back into a string.
- Overrides:
decompile
in class BaseFunction
- Following copied from class:
org.mozilla.javascript.BaseFunction
- Parameters:
cx
- Current contextindent
- How much to indent the decompiled resultjustbody
- Whether the decompilation should omit the
function header and trailing brace.
getArity
public int getArity()
- Overrides:
getArity
in class BaseFunction
getLength
public int getLength()
- Overrides:
getLength
in class BaseFunction
initAsConstructor
public void initAsConstructor(Scriptable scope,
Scriptable prototype)
- Prepare to be used as constructor .
- Parameters:
scope
- constructor scopeprototype
- DontEnum, DontDelete, ReadOnly prototype property
of the constructor