org.mozilla.javascript

Class NativeFunction

Implemented Interfaces:
Callable, DebuggableObject, Function, IdFunctionCall, Scriptable, Serializable

public abstract class NativeFunction
extends BaseFunction

This class implements the Function native object. See ECMA 15.3.
Author:
Norris Boyd

Field Summary

Fields inherited from class org.mozilla.javascript.ScriptableObject

DONTENUM, EMPTY, PERMANENT, READONLY

Fields inherited from interface org.mozilla.javascript.Scriptable

NOT_FOUND

Method Summary

int
getArity()
DebuggableScript
getDebuggableView()
String
getEncodedSource()
Get encoded source string.
protected abstract int
getLanguageVersion()
int
getLength()
protected abstract int
getParamAndVarCount()
Get number of declared parameters and variables defined through var statements.
protected abstract int
getParamCount()
Get number of declared parameters.
protected abstract String
getParamOrVarName(int index)
Get parameter or variable name.
void
initScriptFunction(Context cx, Scriptable scope)
String
jsGet_name()
Deprecated. Use BaseFunction.getFunctionName() instead.

Methods inherited from class org.mozilla.javascript.BaseFunction

call, construct, createObject, execIdCall, fillConstructorProperties, findInstanceIdInfo, findPrototypeId, getArity, getClassName, getClassPrototype, getFunctionName, getInstanceIdName, getInstanceIdValue, getLength, getMaxInstanceId, hasInstance, initPrototypeId, setImmunePrototypeProperty, setInstanceIdValue

Methods inherited from class org.mozilla.javascript.IdScriptableObject

activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultPut, delete, execIdCall, exportAsJSClass, fillConstructorProperties, findInstanceIdInfo, findPrototypeId, get, getAttributes, getInstanceIdName, getInstanceIdValue, getMaxInstanceId, has, hasPrototypeMap, incompatibleCallError, initPrototypeConstructor, initPrototypeId, initPrototypeMethod, initPrototypeValue, instanceIdInfo, put, setAttributes, setInstanceIdValue

Methods inherited from class org.mozilla.javascript.ScriptableObject

associateValue, callMethod, callMethod, defineClass, defineClass, defineClass, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, equivalentValues, get, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassName, getClassPrototype, getDefaultValue, getFunctionPrototype, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isSealed, put, put, putProperty, putProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setParentScope, setPrototype

Method Details

getArity

public int getArity()
Overrides:
getArity in interface BaseFunction

getDebuggableView

public DebuggableScript getDebuggableView()

getEncodedSource

public String getEncodedSource()
Get encoded source string.

getLanguageVersion

protected abstract int getLanguageVersion()

getLength

public int getLength()
Overrides:
getLength in interface BaseFunction

getParamAndVarCount

protected abstract int getParamAndVarCount()
Get number of declared parameters and variables defined through var statements.

getParamCount

protected abstract int getParamCount()
Get number of declared parameters. It should be 0 for scripts.

getParamOrVarName

protected abstract String getParamOrVarName(int index)
Get parameter or variable name. If index <32getParamCount(), then return the name of the corresponding parameter. Otherwise returm the name of variable.

initScriptFunction

public final void initScriptFunction(Context cx,
                                     Scriptable scope)

jsGet_name

public String jsGet_name()

Deprecated. Use BaseFunction.getFunctionName() instead. For backwards compatibility keep an old method name used by Batik and possibly others.