Product Site

3.1. ::ANNOTATE

The ::ANNOTATE directive creates annotations to the package, its classes, methods, attributes, constants, or routines.

The ::ANNOTATE directive can add metadata information (called "annotations") in the form of name/value pairs to the current package, or any of its classes, methods, attributes, constants, and routines.

An annotation attribute, class, constant, method, and routine must be a valid class name, constant name, method name, or routine name defined with its respective directive in the same source program.

The annotation name must be a symbol that is taken as a constant; a literal string is not allowed. The annotation value must be a single literal string, a symbol, or a valid number, optionally preceded by a plus or minus sign, that is taken as a constant.
Example 3.1. ANNOTATE directive
::annotate package author "B. Fox"                 -- annotate current package

::class command

::attribute address
::attribute command

::method init
use strict arg command, address = ""
self~command = command
self~address = address

::annotate class command languagelevel "6.05"      -- annotate class COMMAND
::annotate attribute command os "unix windows mac" -- annotate attribute COMMAND
::annotate method init version "100" maxParms 2    -- annotate method INIT

Notes:
  1. Each ::ANNOTATE directive, except for ::ANNOTATE PACKAGE, must be placed after its respective ::ATTRIBUTE, ::CLASS, ::CONSTANT, ::METHOD, or ::ROUTINE directive in the sourcefile.
  2. When annotating non-floating attributes, constants, or methods, the ::ANNOTATE directive must precede any following ::CLASS directive.
  3. An annotation for an attribute, a method, or a routine should be placed after any attribute/method/routine code body, as ::ANNOTATE, like any other directive, will end the code body.
  4. A subclass of an annotated class will not inherit any annotations of its superclass or mixinclass.
  5. A copy of an annotated method, package, or routine object will keep any existing annotations.
  6. The ::ANNOTATE directive cannot be used to annotate packages, classes, methods, attributes, constants, and routines which are provided by Rexx or have been made available through a ::REQUIRES directive.
  7. Currently Rexx does not use or predefine any specific annotation names.
  8. To query an annotation name/value pair, to get a list of all attached annotation name/value pairs, or to add new or change existing annotations, use