Skip to main content
Previous sectionNext section

ClassType

Specifies the type (or behavior) of this class.

Usage

To specify the type of class (if needed), use the following syntax:

Class MyApp.MyClass [ ClassType = classtype ]  
{ //class members }
Copy code to clipboard

Where classtype is one of the following:

  • datatype — the class is a data type class and is used to represent a literal value.

  • persistent — the class represents data to be stored in the database.

  • serial — the class represents data to be stored (in its serialized state) in another persistent object.

  • stream — the class represents streaming data.

  • view — the class is used to define an SQL view (see the ViewQuery keyword).

  • index — the class is an index class, a specialized class that defines an index interface. For details, see %Library.FunctionalIndex in the class reference.

  • An empty string, which indicates that this class has no specific type. Abstract classes typically do not specify a class type.

If this keyword is not specified, the class type is inherited from the primary superclass, if there is one.

Note that ClassType is specified for system classes such as %RegisteredObject, %SerialObject, %Persistent, and data type classes, so you do not generally need to specify this keyword if you subclass those classes.

Details

This keyword specifies how this class is to be used. The class compiler uses the ClassType keyword to determine how to compile a class. For example, if ClassType is persistent, the class compiler additionally invokes the storage compiler to generate persistence code for a class. Unless explicitly defined, the value of ClassType is either the default value or it is inherited from the primary superclass.

For persistent classes, an explicit ClassType statement is only required when standard persistence behavior is being overridden. If a class definition includes such a statement, it is either because a developer has specified it or because the class originated in code developed with an older version of InterSystems IRIS.

Effect on Subclasses

This keyword is inherited from the primary superclass. The subclass can override the value of the keyword.

Default

If you omit this keyword, the class type is inherited from the primary superclass, if there is one.

Note:

The ClassType for sharded classes cannot have any value other than persistent.

See Also