This is a helper class for implementing wrappers around Scriptable
objects. It implements the Function interface and delegates all
invocations to a delegee Scriptable object. The normal use of this
class involves creating a sub-class and overriding one or more of
the methods.
A useful application is the implementation of interceptors,
pre/post conditions, debugging.
construct
public Scriptable construct(Context cx,
Scriptable scope,
Object[] args) Note that if the delegee is null,
this method creates a new instance of the Delegator itself
rathert than forwarding the call to the
delegee. This permits the use of Delegator
prototypes.
- construct in interface Function
cx - the current Context for this threadscope - an enclosing scope of the caller except
when the function is called from a closure.args - the array of arguments
delete
public void delete(String name)
- delete in interface Scriptable
org.mozilla.javascript.Scriptable.delete
delete
public void delete(int index)
- delete in interface Scriptable
org.mozilla.javascript.Scriptable.delete
get
public Object get(String name,
Scriptable start)- get in interface Scriptable
org.mozilla.javascript.Scriptable.get
getDefaultValue
public Object getDefaultValue(Class hint)
Note that this method does not get forwarded to the delegee if
the hint parameter is null,
ScriptRuntime.ScriptableClass or
ScriptRuntime.FunctionClass. Instead the object
itself is returned.
- getDefaultValue in interface Scriptable
getDelegee
public Scriptable getDelegee()
Retrieve the delegee.
has
public boolean has(String name,
Scriptable start)- has in interface Scriptable
org.mozilla.javascript.Scriptable.has
newInstance
protected Delegator newInstance()
Crete new Delegator instance.
The default implementation calls this.getClass().newInstance().
construct(Context cx, Scriptable scope, Object[] args)
put
public void put(String name,
Scriptable start,
Object value)- put in interface Scriptable
org.mozilla.javascript.Scriptable.put
put
public void put(int index,
Scriptable start,
Object value)- put in interface Scriptable
org.mozilla.javascript.Scriptable.put
setDelegee
public void setDelegee(Scriptable obj)
Set the delegee.