Tagged Value Macros

Return to Introduction  Previous page  Next page

Tagged Value macros are a special form of field substitution macros, which provide access to element tags and the corresponding Tagged Values.

Use 1: Direct Substitution 

This form of the macro directly substitutes the value of the named tag into the output.

Structure: %<macroName>:"<tagName>"% 

<macroName> can be one of:

·attTag
·classTag
·opTag
·packageTag
·paramTag
·connectorTag
·connectorSourceTag
·connectorDestTag
·linkTag
·linkAttTag

This corresponds to the tags for attributes, classes, operations, packages, parameters, connectors with both ends and links including the attribute end respectively. 

<tagName> is a string representing the specific tag name.

Examples:

%opTag:"attribute"%

Use 2: Conditional Substitution

This form of the macro mimics the conditional substitution defined for field substitution macros.

Structure: %<macroName>:"<tagName>" [ == "<test>"] ? <subTrue> [ : <subFalse> ]%

Where:

·<macroName> and <tagName> are as defined above
·[ <text> ] denotes that <text> is optional
·<test> is a string representing a possible value for the macro
·<subTrue> and <subFalse> can be a combination of quoted strings and the keyword value. Where the value is used, it gets replaced with the macro's value in the output.

Examples:

%opTag:"opInline" ? "inline" : ""%

%opTag:"opInline" ? "inline"%

%classTag:"unsafe" == "true" ? "unsafe" : ""%

%classTag:"unsafe" == "true" ? "unsafe"%

Tagged value macros use the same naming convention as field substitution macros.