C# Class Rhino.Delegator

This is a helper class for implementing wrappers around Scriptable objects.
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.
Inheritance: System.Function
显示文件 Open project: hazzik/Rhino.Net

Protected Properties

Property Type Description
obj Scriptable

Public Methods

Method Description
Call ( Context cx, Scriptable scope, Scriptable thisObj, object args ) : object
Construct ( Context cx, Scriptable scope, object args ) : Scriptable

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.

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.

Delegator ( ) : System

Create a Delegator prototype.

Create a Delegator prototype. This constructor should only be used for creating prototype objects of Delegator.

Delegator ( Scriptable obj ) : System

Create a new Delegator that forwards requests to a delegee Scriptable object.

Create a new Delegator that forwards requests to a delegee Scriptable object.

Delete ( int index ) : void
Delete ( string name ) : void
Get ( int index, Scriptable start ) : object
Get ( string name, Scriptable start ) : object
GetClassName ( ) : string
GetDefaultValue ( Type hint ) : object

Note that this method does not get forwarded to the delegee if the hint parameter is null, ScriptRuntime.ScriptableClass or ScriptRuntime.FunctionClass.

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.

GetDelegee ( ) : Scriptable

Retrieve the delegee.

Retrieve the delegee.

GetIds ( ) : object[]
GetParentScope ( ) : Scriptable
GetPrototype ( ) : Scriptable
Has ( int index, Scriptable start ) : bool
Has ( string name, Scriptable start ) : bool
HasInstance ( Scriptable instance ) : bool
Put ( int index, Scriptable start, object value ) : void
Put ( string name, Scriptable start, object value ) : void
SetDelegee ( Scriptable obj ) : void

Set the delegee.

Set the delegee.

SetParentScope ( Scriptable parent ) : void
SetPrototype ( Scriptable prototype ) : void

Protected Methods

Method Description
NewInstance ( ) : Delegator

Crete new Delegator instance.

Crete new Delegator instance. The default implementation calls this.getClass().newInstance().

Method Details

Call() public method

public Call ( Context cx, Scriptable scope, Scriptable thisObj, object args ) : object
cx Context
scope Scriptable
thisObj Scriptable
args object
return object

Construct() public method

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.
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.
public Construct ( Context cx, Scriptable scope, object args ) : Scriptable
cx Context the current Context for this thread
scope Scriptable /// an enclosing scope of the caller except /// when the function is called from a closure. ///
args object the array of arguments
return Scriptable

Delegator() public method

Create a Delegator prototype.
Create a Delegator prototype. This constructor should only be used for creating prototype objects of Delegator.
public Delegator ( ) : System
return System

Delegator() public method

Create a new Delegator that forwards requests to a delegee Scriptable object.
Create a new Delegator that forwards requests to a delegee Scriptable object.
public Delegator ( Scriptable obj ) : System
obj Scriptable the delegee
return System

Delete() public method

public Delete ( int index ) : void
index int
return void

Delete() public method

public Delete ( string name ) : void
name string
return void

Get() public method

public Get ( int index, Scriptable start ) : object
index int
start Scriptable
return object

Get() public method

public Get ( string name, Scriptable start ) : object
name string
start Scriptable
return object

GetClassName() public method

public GetClassName ( ) : string
return string

GetDefaultValue() public method

Note that this method does not get forwarded to the delegee if the hint parameter is null, ScriptRuntime.ScriptableClass or ScriptRuntime.FunctionClass.
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.
public GetDefaultValue ( Type hint ) : object
hint System.Type the type hint
return object

GetDelegee() public method

Retrieve the delegee.
Retrieve the delegee.
public GetDelegee ( ) : Scriptable
return Scriptable

GetIds() public method

public GetIds ( ) : object[]
return object[]

GetParentScope() public method

public GetParentScope ( ) : Scriptable
return Scriptable

GetPrototype() public method

public GetPrototype ( ) : Scriptable
return Scriptable

Has() public method

public Has ( int index, Scriptable start ) : bool
index int
start Scriptable
return bool

Has() public method

public Has ( string name, Scriptable start ) : bool
name string
start Scriptable
return bool

HasInstance() public method

public HasInstance ( Scriptable instance ) : bool
instance Scriptable
return bool

NewInstance() protected method

Crete new Delegator instance.
Crete new Delegator instance. The default implementation calls this.getClass().newInstance().
protected NewInstance ( ) : Delegator
return Delegator

Put() public method

public Put ( int index, Scriptable start, object value ) : void
index int
start Scriptable
value object
return void

Put() public method

public Put ( string name, Scriptable start, object value ) : void
name string
start Scriptable
value object
return void

SetDelegee() public method

Set the delegee.
Set the delegee.
public SetDelegee ( Scriptable obj ) : void
obj Scriptable the delegee
return void

SetParentScope() public method

public SetParentScope ( Scriptable parent ) : void
parent Scriptable
return void

SetPrototype() public method

public SetPrototype ( Scriptable prototype ) : void
prototype Scriptable
return void

Property Details

obj protected_oe property

protected Scriptable obj
return Scriptable