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

Field Summary
static int CONSTRUCTOR_ONLY
           
static int FUNCTION_AND_CONSTRUCTOR
           
static int FUNCTION_ONLY
           
 
Fields inherited from class org.mozilla.javascript.ScriptableObject
DONTENUM, EMPTY, PERMANENT, READONLY
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
IdFunction(IdFunctionMaster master, java.lang.String name, int id)
           
 
Method Summary
 java.lang.Object call(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
          Should be overridden.
 Scriptable construct(Context cx, Scriptable scope, java.lang.Object[] args)
          Call the function as a constructor.
 java.lang.String decompile(Context cx, int indent, boolean justbody)
          Decompile the source information associated with this js function/script back into a string.
 int functionType()
           
 int getArity()
           
 int getLength()
           
 Scriptable getPrototype()
          Get the prototype of the object.
 void initAsConstructor(Scriptable scope, Scriptable prototype)
          Prepare to be used as constructor .
 void setFunctionType(int type)
           
 
Methods inherited from class org.mozilla.javascript.BaseFunction
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, 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
 

Field Detail

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
Constructor Detail

IdFunction

public IdFunction(IdFunctionMaster master,
                  java.lang.String name,
                  int id)
Method Detail

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 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

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 thread
scope - 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 context
indent - How much to indent the decompiled result
justbody - 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 scope
prototype - DontEnum, DontDelete, ReadOnly prototype property of the constructor