Syntax of Properties in Class Definitions
Introduction
A property contains information relevant to an instance of a class. You can add property definitions to object classes. They are not meaningful in other kinds of classes.
Details
A property definition has the following structure:
/// description
Property name As classname (parameter_list) [ keyword_list ] ;
Or (for a list property):
/// description
Property name As List Of classname (parameter_list) [ keyword_list ] ;
Or (for an array property):
/// description
Property name As Array Of classname (parameter_list) [ keyword_list ] ;
Or (for a relationship property):
/// description
Relationship name As classname [ keyword_list ] ;
Where:
-
description (optional) is intended for display in the Class Reference. The description is blank by default. See “Creating Class Documentation” in Defining and Using Classes.
-
name (required) is the name of the property. This must be a valid class member name, and must not conflict with any other class member names.
-
classname (optional) is the name of the class on which this property is based.
-
parameter_list (optional) is a comma-separated list of parameters and their values. If specified, these should be either parameters used by classname or parameters that are available to all properties.
If this list is omitted, also omit the parentheses.
-
keyword_list (required for a relationship property but otherwise optional ) is a comma-separated list of keywords that further define the property.
See “Property Syntax and Keywords” for a complete keyword list.
If this list is omitted, also omit the square brackets.
Relationships are not supported for sharded classes.
Example
/// Person's Social Security number.
Property SSN As %String(PATTERN = "3N1""-""2N1""-""4N") [ Required ];
See Also
-
“Defining and Using Literal Properties” in Defining and Using Classes
-
“Working with Collections” in Defining and Using Classes
-
“Working with Streams” in Defining and Using Classes
-
“Defining and Using Object-Valued Properties” in Defining and Using Classes
-
“Defining and Using Relationships” in Defining and Using Classes
-
“Class Limits” in “General System Limits” in the Orientation Guide for Server-Side Programming