25.01.2015 Views

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The Dynamic Dispatch Methods<br />

22.2.1 Return Values<br />

None of the dispatch methods have specified return values. This is because each should provide<br />

output that is of the same type of the call that originally created the need for the dispatch.<br />

If the dispatch method cannot resolve the method or property, it can use $ZUTIL(96,3) to<br />

throw a or error —<br />

or whatever else may be appropriate.<br />

22.3 The Dynamic Dispatch Methods<br />

The following methods may be implemented to resolve unknown methods and properties:<br />

• %DispatchMethod<br />

• %DispatchClassMethod<br />

• %DispatchGetProperty<br />

• %DispatchSetProperty<br />

• %DispatchSetMultidimProperty<br />

• %DispatchGetModified<br />

• %DispatchSetModified<br />

22.3.1 %DispatchMethod<br />

This method implements an unknown method call. Its syntax is:<br />

Method %DispatchMethod(Method As %String, Args...)<br />

where its first argument is the name of the referenced method and the second argument is an<br />

array that holds all the arguments passed to the original method. Since the number of arguments<br />

and their types can vary depending on the method being resolved, the code in<br />

%DispatchMethod needs to handle them correctly (since the class compiler can not make<br />

any assumptions about the type). The Args... syntax handles this flexibly.<br />

Because %DispatchMethod attempts to resolve any unknown instance method associated<br />

with the class, it has no specified return value; if successful, it returns a value whose type is<br />

determined by the method being resolved and whether the caller expects a return value.<br />

<strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong> 189

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!