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.

Attribute Properties<br />

CAUTION:<br />

Do not set the property equal to the empty string using open- and close-quotes<br />

(""), as this can result in values that are not valid or errors.<br />

This is particularly significant if the application is using an external interface,<br />

such as Java.<br />

7.5.2 Object-Valued Properties<br />

An object-valued property is a reference to another object, either embedded or persistent. In<br />

either case, the value of the property is an OREF while in memory. On disk, a reference to a<br />

persistent object becomes an OID, while an embedded object becomes a single serialized<br />

string containing all of the embedded object's properties.<br />

For instance, if an object-valued property, Doc, is of the type Doctor (where Doctor is either<br />

a persistent object or an embeddable object), the definition of Doc is:<br />

Property Doc As Doctor;<br />

7.5.3 Collection Properties<br />

A collection property is one that contains a group (or collection) of individual elements, all<br />

of the same type. To specify a collection property, place the collection type at the start of the<br />

property definition. <strong>Caché</strong> supports two kinds of collections, called List and Array collections..<br />

The property type determines the contents of the collection. For example, the following code<br />

defines a Colors property which is a list collection of %String values:<br />

// Property Colors As List Of %String;<br />

Property Colors As List Of %String; // the current syntax<br />

Similarly, <strong>Caché</strong> supports object collections, as in the following Doctors property which is<br />

an Array of references to Doctor objects:<br />

Property Doctors As Array Of Doctor;<br />

When you create a collection, <strong>Caché</strong> gives it a set of methods through a collection object.<br />

<strong>Caché</strong> includes several kinds of collection objects, each one designed to operate on a different<br />

kind of collection:<br />

Collection <strong>Objects</strong><br />

Type<br />

Data type<br />

Object (persistent or embedded)<br />

Array property<br />

%ArrayOfDataTypes<br />

%ArrayOf<strong>Objects</strong><br />

List property<br />

%ListOfDataTypes<br />

%ListOf<strong>Objects</strong><br />

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

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

Saved successfully!

Ooh no, something went wrong!