MethodAccessor

Kind of class:class
Inherits from:none
Implements:
Version:1.0
Author:Francis Bourre
Classpath:com.bourre.core.MethodAccessor
File last modified:Wednesday, 31 October 2007, 07:35:29
MethodAccessor proxies property accesses (getter/setter) for an instance
with two provided methods.

Use Function access to define getter and setter processes for a specific instance property.

Implements IAccessor interface.

Take a look at PropertyAccessor to see another setter implementation.

See AccessorFactory for accessor automatic build process.

Example

var o : IAccessor = new MethodAccessor( this, setMyProp, getMyProp );
o.setValue( 100 );
var n : Number = o.getValue();

Constructor

MethodAccessor

function MethodAccessor (
fSet:Function, fGet:Function)
Constructs a new MethodAccessor instance

fSet and fGet methods must be defined in t instance context.

Parameters:
t :
Object where f function is applied
fSet:
t setter Function
fGet:
t getter Function

Instance methods

getGetterHelper

function getGetterHelper (
)
Returns method used by current getter to retrieve object value.
Returns:
Function

getMethod

function getMethod (
) : Function
Returns setter method reference.
Returns:
Function

getSetterHelper

function getSetterHelper (
)
Returns method used by current setter to modify object value.
Returns:
Function

getTarget

function getTarget (
)
Returns object target.

Where accessor is applied

Returns:
object instance (relaxed type)
Specified by:

getValue

function getValue (
)
Returns current value targeted by the accessor.
Returns:
value
Specified by:

setValue

function setValue (
) : Void
Sets passed-in value to object using setter function defined
during instanciation.
Parameters:
value:
value to set
Specified by:

toString

function toString (
) : String
Returns the string representation of this instance.
Returns:
the string representation of this instance