org.mozilla.javascript
public abstract class IdScriptableObject extends ScriptableObject implements IdFunctionCall
| Constructor Summary | |
|---|---|
| IdScriptableObject() | |
| IdScriptableObject(Scriptable scope, Scriptable prototype) | |
| Method Summary | |
|---|---|
| void | activatePrototypeMap(int maxPrototypeId) |
| protected void | addIdFunctionProperty(Scriptable obj, Object tag, int id, String name, int arity) |
| protected Object | defaultGet(String name) |
| protected void | defaultPut(String name, Object value) |
| void | delete(String name) |
| Object | execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) 'thisObj' will be null if invoked as constructor, in which case
instance of Scriptable should be returned. |
| IdFunctionObject | exportAsJSClass(int maxPrototypeId, Scriptable scope, boolean sealed) |
| protected void | fillConstructorProperties(IdFunctionObject ctor) |
| protected int | findInstanceIdInfo(String name)
Map name to id of instance property.
|
| protected int | findPrototypeId(String name) |
| Object | get(String name, Scriptable start) |
| int | getAttributes(String name) |
| protected String | getInstanceIdName(int id) Map id back to property name it defines. |
| protected Object | getInstanceIdValue(int id) Get id value.
|
| protected int | getMaxInstanceId()
Get maximum id findInstanceIdInfo can generate. |
| boolean | has(String name, Scriptable start) |
| boolean | hasPrototypeMap() |
| protected static EcmaError | incompatibleCallError(IdFunctionObject f)
Utility method to construct type error to indicate incompatible call
when converting script thisObj to a particular type is not possible.
|
| void | initPrototypeConstructor(IdFunctionObject f) |
| protected void | initPrototypeId(int id) |
| void | initPrototypeMethod(Object tag, int id, String name, int arity) |
| void | initPrototypeValue(int id, String name, Object value, int attributes) |
| protected static int | instanceIdInfo(int attributes, int id) |
| void | put(String name, Scriptable start, Object value) |
| void | setAttributes(String name, int attributes) |
| protected void | setInstanceIdValue(int id, Object value)
Set or delete id value. |
private static NativeSomething realThis(Scriptable thisObj,
IdFunctionObject f)
{
if (!(thisObj instanceof NativeSomething))
throw incompatibleCallError(f);
return (NativeSomething)thisObj;
}
Note that although such function can be implemented universally via
java.lang.Class.isInstance(), it would be much more slower.Parameters: readOnly specify if the function f does not change state of object.
Returns: Scriptable object suitable for a check by the instanceof operator.
Throws: RuntimeException if no more instanceof target can be found