Adding Projections to a Class
This chapter discusses how to add projection definitions in a class definition.
A projection definition instructs the InterSystems IRIS class compiler to perform specified operations when a class definition is compiled or removed. A projection defines the name of a projection class (derived from the %Projection.AbstractProjection
class) that implements methods that are called when either of the following is true:
A class can contain any number of projection definitions. The actions for all of them are invoked when the class is compiled (the order in which they are invoked is not defined).
InterSystems IRIS includes predefined projection classes that generate client code that allows access to a class from Java, MV, and so on.
You can also create your own projection classes and use them from Studio as you would any built-in projection class.
You can add a new projection to a class definition in two ways:
To add a projection using the Class Editor, position the cursor at a blank line and enter a projection declaration.
Alternatively, you can copy and paste an existing projection declaration and then edit it.
You can invoke the New Projection wizard by selecting
. Alternatively right-click in the Class Inspector and select
The New Projection wizard displays pages prompting you for information about the new projection. You can click Finish
before completing all of the wizard pages; in this case, default values are provided for any information you have not specified.
The New Projection wizard prompts you for the following information (you can later modify any of these values):
(required) Name of the new projection. This name must be a valid projection name and must not conflict with the name of a previously defined projection.
(optional) Description of the new projection.
The projection type determines what actions happen when your class definition is compiled or removed. You can select what kind of projection you would like to define.
Name of a projection class whose methods are executed when a class definition is compiled or removed.
A set of name-value pairs that control the behavior of the projection class. The list of available parameter names is determined by the selected projection class.
When you finish running the New Projection wizard, the Class Editor window is updated to include the new projection definition. For example:
/// This is a Person class
class MyApp.Person extends %Persistent
Property Name As %String;
Projection JavaClient As %Projection.Java;
To edit this projection definition, use either the Class Editor or the Class Inspector.
Content Date/Time: 2019-07-15 06:54:33