25.01.2015 Views

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Properties<br />

Property Behavior<br />

The property behavior classes are system classes. You cannot specify or modify property<br />

behavior.<br />

For example, if we define a class Person with three properties:<br />

Class MyApp.Person Extends %Persistent [ClassType = persistent]<br />

{<br />

Property Name As %String;<br />

Property Age As %Integer;<br />

Property DOB As %Date;<br />

}<br />

The compiled Person class has a set of methods automatically generated for each of its<br />

properties. These methods are inherited from the system Property class as well as the data<br />

type class associated with the property. The names of these generated methods are the property<br />

name concatenated with the name of the method from the inherited class. For example, some<br />

of the methods associated with the DOB property are:<br />

Set x = person.DOBIsValid(person.DOB)<br />

Write person.DOBLogicalToDisplay(person.DOB)<br />

where IsValid is a method of the property class and LogicalToDisplay is a method of the<br />

%Date data type class.<br />

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

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

Saved successfully!

Ooh no, something went wrong!