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.

You can override a property's default accessor methods. In the last screen of the New Property<br />

Wizard in the Studio, you can select the check boxes for creating a custom Get method, Set,<br />

or both; if so the Studio creates signatures for the custom methods. Within the custom methods,<br />

you can perform any special processing that your application requires.<br />

Invoking a Set method from within a Set method creates a recursive series of references that<br />

results in a stack overflow; likewise for Get methods. To avoid this situation, <strong>Caché</strong> provides<br />

a mechanism for working with a property's instance value that circumvents the accessor<br />

methods. This mechanism refers to a property's instance variable directly by using syntax of<br />

i%, where is the name of property being accessed.<br />

For example, to directly set the value of the LName instance variable, the “i%” syntax is:<br />

Set i%LName = "Blutarsky"<br />

i% Syntax<br />

This directly sets “Blutarsky” as the value of the instance variable LName, bypassing the<br />

LNameSet accessor. The advantage of this mechanism is that it gives you direct control over<br />

the instance variable's value. This must be used with caution and only under appropriate circumstances,<br />

since the ability to circumvent any checking done in the property's Set method<br />

can result in properties containing non-valid values.<br />

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

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

Saved successfully!

Ooh no, something went wrong!