| java.lang.Object org.mozilla.javascript.Delegator
All known Subclasses: org.mozilla.javascript.Synchronizer,
Delegator | public class Delegator implements Function(Code) | | 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.
See Also: Function See Also: Scriptable author: Matthias Radestock |
Constructor Summary | |
public | Delegator() Create a Delegator prototype. | public | Delegator(Scriptable obj) Create a new Delegator that forwards requests to a delegee
Scriptable object. |
Method Summary | |
public Object | call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) | 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 . | public void | delete(String name) | public void | delete(int index) | public Object | get(String name, Scriptable start) | public Object | get(int index, Scriptable start) | public String | getClassName() | 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 . | public Scriptable | getDelegee() Retrieve the delegee. | public Object[] | getIds() | public Scriptable | getParentScope() | public Scriptable | getPrototype() | public boolean | has(String name, Scriptable start) | public boolean | has(int index, Scriptable start) | public boolean | hasInstance(Scriptable instance) | protected Delegator | newInstance() Crete new Delegator instance. | public void | put(String name, Scriptable start, Object value) | public void | put(int index, Scriptable start, Object value) | public void | setDelegee(Scriptable obj) Set the delegee. | public void | setParentScope(Scriptable parent) | public void | setPrototype(Scriptable prototype) |
construct | public Scriptable construct(Context cx, Scriptable scope, Object[] args)(Code) | | 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.
Parameters: cx - the current Context for this thread Parameters: scope - an enclosing scope of the caller exceptwhen the function is called from a closure. Parameters: args - the array of arguments the allocated object See Also: Function.construct(ContextScriptableObject[]) |
getDefaultValue | public Object getDefaultValue(Class hint)(Code) | | 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.
Parameters: hint - the type hint the default value See Also: org.mozilla.javascript.Scriptable.getDefaultValue |
getDelegee | public Scriptable getDelegee()(Code) | | Retrieve the delegee.
the delegee |
|
|