Declaration methods
Pool declarations and variable declarations are defined in declaration methods, which contain specially formatted comments as their method bodies. Declaration methods do not contain executable code.
You can distribute declaration methods throughout the classes of an application and its subapplications. A declaration method can declare one or more application variables, pools, and pool variables.
The selector of a declaration method is prefixed with _PRAGMA_, which must be capitalized. A recommended naming convention uses a descriptive name that applies to the group of declarations, such as the name of the pool being declared.
The declarations in the method comment are introduced by the identifier:
%%PRAGMA DECLARE
A declaration consists of one or more attribute-value pairs, enclosed in parentheses. For example:
_PRAGMA_group1
"%%PRAGMA DECLARE
(name: MyVariable1 comment: 'This declares a global variable')
(name: MyVariable2 isConstant: true valueExpression: '100')
(name: MyPool isPool: true comment: 'This declares a pool')
(name: PoolVariable1 pool: MyPool comment: 'This declares a pool variable')
(name: PoolVariable2 pool: MyPool isConstant: true valueExpression: '200')
The example declares the following items:
• Application variables MyVariable1 and MyVariable2
• Pool MyPool, containing pool variables PoolVariable1 and PoolVariable2
When the example method is used in an application, the variables and pools are declared in the application's namespace.
To make declarations easy to find, add declaration methods only as class methods of the application or subapplication class.
Note:
Executable code or additional comments in a declaration method generate a declaration syntax error.
Last modified date: 01/29/2015