Tagged Value Substitution Macros

Tagged Value macros are a special form of field substitution macros, which provide access to element tags and the corresponding Tagged Values. They can be used in one of two ways:

  • Direct Substitution
  • Conditional Substitution

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
  • connectorDestElemTag
  • connectorDestTag
  • connectorSourceElemTag
  • connectorSourceTag
  • connectorTag
  • linkAttTag
  • linkTag
  • opTag
  • packageTag
  • paramTag

This corresponds to the tags for attributes, Classes, operations, Packages, parameters, connectors with both ends, elements at both ends of connectors and connectors including the attribute end.

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

Example

%opTag:"attribute"%

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 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.

Learn more