Topic
Prev Next

Class Field Substitution Macros

This table provides a list of methods for accessing each available Class property in the Code Generation and Transformation templates.

Field substitution macros are named according to Camel casing. Macros that represent checkboxes return a value of 'T' if the box is selected. Otherwise the value is empty.

Class Macros

Macro Name

Description

See also

elemType

The element type: Interface or Class.

classAbstract

Class 'Properties' dialog: 'Abstract' checkbox ('Details' tab).

classAlias

Class 'Properties' dialog: 'Alias' field.

classArguments

Class 'Detail' dialog: C++ Templates: Arguments.

classAuthor

Class 'Properties' dialog: 'Author' field.

classBaseName

'Type Hierarchy' dialog: Class Name (for use where no connector exists between child and base Classes).

classBaseScope

The scope of the inheritance as reverse engineered. (For use where no connector exists between child and base Classes.)

classBaseVirtual

The virtual property of the inheritance as reverse engineered. (For use where no connector exists between child and base Classes.)

classComplexity

Class 'Properties' dialog: 'Complexity' field.

classCreated

The date and time the Class was created.

classGUID

The unique GUID for the current Class.

classHasConstructor

Looks at the list of methods in the current object and, depending on the conventions of the current language, returns T if one is a default constructor. Typically used with the genOptGenConstructor macro.

Code Generation Option Field Substitution Macros

classHasCopyConstructor

Looks at the list of methods in the current object and, depending on the conventions of the current language, returns T if one is a copy constructor. Typically used with the genOptGenCopyConstructor macro.

classHasDestructor

Looks at the list of methods in the current object and, depending on the conventions of the current language, returns T if one is a destructor. Typically used with the genOptGenDestructor macro.

classHasParent

True, if the Class in scope has one or more base Classes.

classHasStereotype

True, if the Class in scope has a stereotype that matches a stereotype name (which you can optionally specify as fully qualified). It therefore checks all stereotypes that a Class has and returns 'T' if any of them is the specified stereotype or a specialization of it. For example:

  • %classHasStereotype:"block"% will return 'T' for any block-stereotyped Class from any SysML version, including associationBlock
  • %classHasStereotype:"SysML1.4::block"% will specifically match the SysML 1.4 versions

Compare this with classStereotype, later.

classImports

'Code Gen' dialog: Imports.

classIsActive

Class 'Advanced' dialog: 'Is Active' checkbox.

classIsAssociationClass

True, if the Association is an AssociationClass connector.

classIsInstantiated

True, if the Class is an instantiated template Class.

classIsLeaf

Class 'Advanced' dialog: 'Is Leaf' checkbox.

classIsRoot

Class 'Advanced' dialog: 'Is Root' checkbox.

classIsSpecification

Class 'Advanced' dialog: 'Is Specification' checkbox.

classKeywords

Class 'Properties' dialog: 'Keywords' field.

classLanguage

Class 'Properties' dialog: 'Language' field.

classMacros

A space separated list of macros defined for the Class.

classModified

The date and time the Class was last modified.

classMultiplicity

Class 'Advanced' dialog: Multiplicity.

className

Class 'Properties' dialog: 'Name' field.

classNotes

Class 'Properties' dialog: 'Note' field.

classParamDefault

Class 'Detail' dialog.

classParamName

Class 'Detail' dialog.

classParamType

Class 'Detail' dialog.

classPersistence

Class 'Properties' dialog: 'Persistence' field ('Details' tab)

classPhase

Class 'Properties' dialog: 'Phase' field.

classQualName

The Class name prefixed by its outer Classes. Class names are separated by double colons (::).

classScope

Class 'Properties' dialog: 'Scope' field.

classStereotype

Class 'Properties' dialog: 'Stereotype' field. Retrieves the name of the first stereotype applied to the Class. When used in a comparison, it checks whether that first stereotype exactly matches a string.

For example:  %classStereotype=="enumeration" ? "enum" : "class"%

Compare this with classHasStereotype, earlier.

classStatus

Class 'Properties' dialog: 'Status' field.

classVersion

Class 'Properties' dialog: 'Version' field.

Learn more