public abstract class IdScriptableObject extends ScriptableObject implements IdFunctionCall
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
NOT_FOUND
Constructor and Description |
---|
IdScriptableObject() |
IdScriptableObject(Scriptable scope,
Scriptable prototype) |
Modifier and Type | Method and Description |
---|---|
void |
activatePrototypeMap(int maxPrototypeId) |
protected void |
addIdFunctionProperty(Scriptable obj,
java.lang.Object tag,
int id,
java.lang.String name,
int arity) |
protected java.lang.Object |
defaultGet(java.lang.String name) |
protected void |
defaultPut(java.lang.String name,
java.lang.Object value) |
void |
defineOwnProperty(Context cx,
java.lang.Object key,
ScriptableObject desc)
Defines a property on an object.
|
void |
delete(java.lang.String name)
Removes a named property from the object.
|
java.lang.Object |
execIdCall(IdFunctionObject f,
Context cx,
Scriptable scope,
Scriptable thisObj,
java.lang.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(java.lang.String name)
Map name to id of instance property.
|
protected int |
findPrototypeId(java.lang.String name) |
java.lang.Object |
get(java.lang.String name,
Scriptable start)
Returns the value of the named property or NOT_FOUND.
|
int |
getAttributes(java.lang.String name)
Get the attributes of a named property.
|
protected java.lang.String |
getInstanceIdName(int id)
Map id back to property name it defines.
|
protected java.lang.Object |
getInstanceIdValue(int id)
Get id value.
|
protected int |
getMaxInstanceId()
Get maximum id findInstanceIdInfo can generate.
|
protected ScriptableObject |
getOwnPropertyDescriptor(Context cx,
java.lang.Object id) |
boolean |
has(java.lang.String name,
Scriptable start)
Returns true if the named property is defined.
|
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(java.lang.Object tag,
int id,
java.lang.String name,
int arity) |
void |
initPrototypeValue(int id,
java.lang.String name,
java.lang.Object value,
int attributes) |
protected static int |
instanceIdInfo(int attributes,
int id) |
void |
put(java.lang.String name,
Scriptable start,
java.lang.Object value)
Sets the value of the named property, creating it if need be.
|
void |
setAttributes(java.lang.String name,
int attributes)
Set the attributes of a named property.
|
protected void |
setInstanceIdAttributes(int id,
int attr)
Update the attributes of the given instance property.
|
protected void |
setInstanceIdValue(int id,
java.lang.Object value)
Set or delete id value.
|
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getClassName, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, hasInstance, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype, size
public IdScriptableObject()
public IdScriptableObject(Scriptable scope, Scriptable prototype)
protected final java.lang.Object defaultGet(java.lang.String name)
protected final void defaultPut(java.lang.String name, java.lang.Object value)
public boolean has(java.lang.String name, Scriptable start)
ScriptableObject
has
in interface Scriptable
has
in class ScriptableObject
name
- the name of the propertystart
- the object in which the lookup beganScriptable.get(String, Scriptable)
,
ScriptableObject.getProperty(Scriptable, String)
public java.lang.Object get(java.lang.String name, Scriptable start)
ScriptableObject
get
in interface Scriptable
get
in class ScriptableObject
name
- the name of the propertystart
- the object in which the lookup beganContext.getUndefinedValue()
public void put(java.lang.String name, Scriptable start, java.lang.Object value)
ScriptableObject
If the property's attributes include READONLY, no action is taken. This method will actually set the property in the start object.
put
in interface Scriptable
put
in class ScriptableObject
name
- the name of the propertystart
- the object whose property is being setvalue
- value to set the property toScriptable.has(String, Scriptable)
,
Scriptable.get(String, Scriptable)
,
ScriptableObject.putProperty(Scriptable, String, Object)
,
Context.toObject(Object, Scriptable)
public void delete(java.lang.String name)
ScriptableObject
delete
in interface Scriptable
delete
in class ScriptableObject
name
- the name of the propertyScriptable.get(String, Scriptable)
,
ScriptableObject.deleteProperty(Scriptable, String)
public int getAttributes(java.lang.String name)
ScriptableObject
name
as defined for has
.getAttributes
in class ScriptableObject
name
- the identifier for the propertyScriptableObject.has(String, Scriptable)
,
ScriptableObject.READONLY
,
ScriptableObject.DONTENUM
,
ScriptableObject.PERMANENT
,
ScriptableObject.EMPTY
public void setAttributes(java.lang.String name, int attributes)
ScriptableObject
name
as defined for has
.The possible attributes are READONLY, DONTENUM, and PERMANENT. Combinations of attributes are expressed by the bitwise OR of attributes. EMPTY is the state of no attributes set. Any unused bits are reserved for future use.
setAttributes
in class ScriptableObject
name
- the name of the propertyattributes
- the bitset of attributesScriptable.has(String, Scriptable)
,
ScriptableObject.READONLY
,
ScriptableObject.DONTENUM
,
ScriptableObject.PERMANENT
,
ScriptableObject.EMPTY
protected int getMaxInstanceId()
protected static int instanceIdInfo(int attributes, int id)
protected int findInstanceIdInfo(java.lang.String name)
instanceIdInfo(int, int)
.protected java.lang.String getInstanceIdName(int id)
protected java.lang.Object getInstanceIdValue(int id)
protected void setInstanceIdValue(int id, java.lang.Object value)
protected void setInstanceIdAttributes(int id, int attr)
id
- the instance property idattr
- the new attribute bitsetpublic java.lang.Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
execIdCall
in interface IdFunctionCall
public final IdFunctionObject exportAsJSClass(int maxPrototypeId, Scriptable scope, boolean sealed)
public final boolean hasPrototypeMap()
public final void activatePrototypeMap(int maxPrototypeId)
public final void initPrototypeMethod(java.lang.Object tag, int id, java.lang.String name, int arity)
public final void initPrototypeConstructor(IdFunctionObject f)
public final void initPrototypeValue(int id, java.lang.String name, java.lang.Object value, int attributes)
protected void initPrototypeId(int id)
protected int findPrototypeId(java.lang.String name)
protected void fillConstructorProperties(IdFunctionObject ctor)
protected void addIdFunctionProperty(Scriptable obj, java.lang.Object tag, int id, java.lang.String name, int arity)
protected static EcmaError incompatibleCallError(IdFunctionObject f)
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.
f
- function that is attempting to convert 'this'
object.java.lang.RuntimeException
- if no more instanceof target can be foundpublic void defineOwnProperty(Context cx, java.lang.Object key, ScriptableObject desc)
ScriptableObject
defineOwnProperty
in class ScriptableObject
cx
- the current Contextkey
- the name/index of the propertydesc
- the new property descriptor, as described in 8.6.1protected ScriptableObject getOwnPropertyDescriptor(Context cx, java.lang.Object id)
getOwnPropertyDescriptor
in class ScriptableObject