|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.bsf.debug.util.Skeleton | +--org.apache.bsf.engines.javascript.JsObjectStub
Insert the type's description here. Creation date: (8/24/2001 9:54:48 AM)
Field Summary |
---|
Fields inherited from interface org.apache.bsf.debug.jsdi.JsObject |
---|
DONTDELETE, DONTENUM, EMPTY, INTERNAL, READONLY |
Constructor Summary | |
---|---|
JsObjectStub(RhinoEngineDebugger rhinoDbg,
org.mozilla.javascript.Scriptable object)
|
Method Summary | |
---|---|
void |
define(java.lang.String propertyName,
JsObject value,
int attributes)
|
void |
define(java.lang.String propertyName,
java.lang.Object value,
int attributes)
The value can be any of the following type: java.lang.Boolean java.lang.Number java.lang.String org.apache.bsf.debug.jsdi.JsObject |
void |
delete(int index)
Removes a property from this object. |
void |
delete(java.lang.String name)
Removes a property from this object. |
java.lang.Object |
get(int index)
|
java.lang.Object |
get(java.lang.String name)
Get a named property from the object. |
java.lang.String |
getClassName()
Get the name of the set of objects implemented by this Java class. |
java.lang.Object |
getDefaultValue(java.lang.Class hint)
Get the default value of the object with a given hint. |
java.lang.Object[] |
getIds(boolean all)
Returns an array of property ids defined on this object. |
JsObject |
getPrototype()
Get the prototype of the object. |
JsObject |
getScope()
The scope is for supporting two things. |
boolean |
has(int index)
Indicates whether or not an indexed property is defined in an object. |
boolean |
has(java.lang.String name)
Indicates whether or not a named property is defined in an object. |
boolean |
hasInstance(JsObject instance)
The instanceof operator. |
boolean |
isFunction()
|
boolean |
isScript()
|
boolean |
isWrapper()
|
void |
put(int index,
java.lang.Object value)
Sets an indexed property in this object. |
void |
put(java.lang.String name,
java.lang.Object value)
Sets a named property in this object. |
void |
setPrototype(JsObject prototype)
Set the prototype of the object. |
void |
setScope(JsObject jsobj)
Set the prototype of the object. |
java.lang.Object |
unwrap()
|
boolean |
wrapsJavaObject()
|
Methods inherited from class org.apache.bsf.debug.util.Skeleton |
---|
addListener, allocOid, completeFuture, createFuture, equals, getTid, getUid, hasNoUid, removeListener, suspendFuture |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JsObjectStub(RhinoEngineDebugger rhinoDbg, org.mozilla.javascript.Scriptable object) throws java.rmi.RemoteException
Method Detail |
public void define(java.lang.String propertyName, JsObject value, int attributes)
public void define(java.lang.String propertyName, java.lang.Object value, int attributes)
JsObject
define
in interface JsObject
public void delete(int index)
JsObject
A property can be made permanent by ignoring calls to remove
it.
The property is specified by an integral index
as defined for get
.
To delete properties defined in a prototype chain,
first find the owner object of the property and then
call deleteProperty on that owner object.
Identical to delete(String)
except that
an integral index is used to select the property.
delete
in interface JsObject
index
- the numeric index for the propertyScriptable.get(java.lang.String, org.mozilla.javascript.Scriptable)
,
ScriptableObject.deleteProperty(org.mozilla.javascript.Scriptable, java.lang.String)
public void delete(java.lang.String name)
JsObject
A property can be made permanent by ignoring calls to remove it.
The property is specified by a String name
as defined for get
.
To delete properties defined in a prototype chain, first find the owner object of the property and then call deleteProperty on that owner object.
delete
in interface JsObject
name
- the identifier for the propertyScriptable.get(java.lang.String, org.mozilla.javascript.Scriptable)
,
ScriptableObject.deleteProperty(org.mozilla.javascript.Scriptable, java.lang.String)
public java.lang.Object get(int index) throws java.rmi.RemoteException
get
in interface JsObject
java.rmi.RemoteException
public java.lang.Object get(java.lang.String name) throws java.rmi.RemoteException
JsObject
get
that takes an
integer:
JavaScript code | Java code |
---|---|
a.b | a.get("b", a) |
a["foo"] | a.get("foo", a) |
a[3] | a.get(3, a) |
a["3"] | a.get(3, a) |
a[3.0] | a.get(3, a) |
a["3.0"] | a.get("3.0", a) |
a[1.1] | a.get("1.1", a) |
a[-4] | a.get(-4, a) |
The values that may be returned are limited to the following:
get
in interface JsObject
name
- the name of the property
java.rmi.RemoteException
public java.lang.String getClassName()
JsObject
See ECMA 8.6.2 and 15.2.4.2.
getClassName
in interface JsObject
public java.lang.Object getDefaultValue(java.lang.Class hint)
JsObject
A hint
of null means "no hint".
See ECMA 8.6.2.6.
getDefaultValue
in interface JsObject
hint
- the type hint
public java.lang.Object[] getIds(boolean all)
JsObject
getIds
in interface JsObject
public JsObject getPrototype() throws java.rmi.RemoteException
JsObject
getPrototype
in interface JsObject
java.rmi.RemoteException
public JsObject getScope() throws java.rmi.RemoteException
JsObject
getScope
in interface JsObject
java.rmi.RemoteException
public boolean has(int index)
JsObject
The property is specified by an integral index
as defined for the get
method.
has
in interface JsObject
index
- the numeric index for the property
Scriptable.get(java.lang.String, org.mozilla.javascript.Scriptable)
,
ScriptableObject.getProperty(org.mozilla.javascript.Scriptable, java.lang.String)
public boolean has(java.lang.String name)
JsObject
The property is specified by a String name
as defined for the get
method.
has
in interface JsObject
name
- the name of the property
Scriptable.get(java.lang.String, org.mozilla.javascript.Scriptable)
,
ScriptableObject.getProperty(org.mozilla.javascript.Scriptable, java.lang.String)
public boolean hasInstance(JsObject instance)
JsObject
The JavaScript code "lhs instanceof rhs" causes rhs.hasInstance(lhs) to be called.
The return value is implementation dependent so that embedded host objects can return an appropriate value. See the JS 1.3 language documentation for more detail.
This operator corresponds to the proposed EMCA [[HasInstance]] operator.
hasInstance
in interface JsObject
instance
- The value that appeared on the LHS of the instanceof
operator
public boolean isFunction()
isFunction
in interface JsObject
public boolean isScript()
isScript
in interface JsObject
public boolean isWrapper()
public void put(int index, java.lang.Object value)
JsObject
The property is specified by an integral index
as defined for get
.
put
in interface JsObject
index
- the numeric index for the propertyvalue
- value to set the property topublic void put(java.lang.String name, java.lang.Object value)
JsObject
The property is specified by a string name
as defined for get
.
Note that if a property a is defined in the prototype p
of an object o, then evaluating o.a = 23
will cause
set
to be called on the prototype p with
o as the start parameter.
To preserve JavaScript semantics, it is the Scriptable
object's responsibility to modify o.
This design allows properties to be defined in prototypes and implemented in terms of getters and setters of Java values without consuming slots in each instance.
The values that may be set are limited to the following:
IMPORTANT: JAVA OBJECTS. The wrapping is not yet supported.
put
in interface JsObject
public void setPrototype(JsObject prototype)
JsObject
setPrototype
in interface JsObject
prototype
- the prototype to setpublic void setScope(JsObject jsobj)
JsObject
setScope
in interface JsObject
public java.lang.Object unwrap()
public boolean wrapsJavaObject()
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |