olua.lib
Class Proxy

olua.lib.Object
└─ olua.lib.Proxy

I forward on all unhandled messages to a different object and return the result. The proxy target may be changed dynamically at run time.

I'm useful for particular constructions where you want one object to act like another object based on runtime considerations. For example, consider a button in a web application: a text-only button may be implemented as a simple HTML button, while a button with an image may have to be implemented as a complex DHTML object. My subclassing me, you can create a generic FlexibleButton class that can examine its parameters at run time and then become either an HTMLButton or a ImageButton by instantiating the appropriate object and setting it as the proxy target.


Constructor Summary
- initWithTarget: newtarget
Initialises me to point at the given target.
Method Summary
- forwardInvocation: message
Handles a message on me.
- performSelector: selector withArgs: args
Calls a method on the target.
- proxyTarget
Returns my current target.
- respondsToSelector: selector
Tests whether I respond to a given selector.
- setProxyTarget: newtarget
Changes my current target.
Method Detail

- forwardInvocation: message

Handles a message on me.

Don't call this; it is used by the runtime.

Parameters:
message - the message
Returns:
whatever the message returns

- initWithTarget: newtarget

Initialises me to point at the given target.

Parameters:
newtarget - the new target
Returns:
the receiver

- isProxy

Test whether I am a proxy.

I am a proxy.

Returns:
true

- performSelector: selector withArgs: args

Calls a method on the target.

Parameters:
selector - the (mangled) selector
args - an array of arguments
Returns:
whatever the method returns

- proxyTarget

Returns my current target.

Returns:
the current target

- respondsToSelector: selector

Tests whether I respond to a given selector.

The default implementation passes the request on to the target.

Parameters:
selector - the (mangled) selector
Returns:
true or false

- setProxyTarget: newtarget

Changes my current target.

Parameters:
newtarget - the new target
Returns:
the old target

- toString

Returns an identifier string describing me.

Returns:
a string