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.

16<br />

Class Projections<br />

Class projections provide a way to extend the behavior of the <strong>Caché</strong> Class Compiler. A class<br />

projection associates a class definition with a projection class. A projection class (derived<br />

from the %Projection.AbstractProjection class) provides methods that are invoked by the Class<br />

Compiler when it compiles and removes a class definition.<br />

Projection classes are used by <strong>Caché</strong> to automatically generate additional code when a class<br />

is compiled as well as perform needed cleanup when a class is deleted. The projection<br />

mechanism is used by the Java, EJB, and C++ projections (hence the origin of the term<br />

“projection” ) to automatically generate the necessary client binding code (Java or C++)<br />

whenever a class is compiled.<br />

16.1 Projection Definitions<br />

Every class definition may optionally include one or more projection definitions. Each definition<br />

has a unique name and specifies the projection class to be used for the projection as<br />

well as parameter values that are passed to the projection methods (allowing each projection<br />

to have customized behavior).<br />

16.1.1 Adding a Projection to a Class<br />

You can associate a projection with a class by adding a projection definition to its class definition.<br />

In <strong>Caché</strong> Studio you can do this using the Projection statement within a class definition:<br />

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

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

Saved successfully!

Ooh no, something went wrong!