Field Substitution Macros

Return to Introduction  Previous page  Next page

The field substitution macros provide access to data in the model. In particular, they are used to access data fields from:

·Packages
·Classes
·Attributes
·Operations
·Parameters.

Field substitution macros are named according to Camel casing. By convention, the macro is prefixed with an abbreviated form of the corresponding model element. For example, attribute-related macros begin with att, as in the %attName% macro, to access the name of the attribute in scope.

The following table lists each of the field substitution macros with a description of the result.

Note: Macros that represent checkboxes return a value of T if the box is selected. Otherwise the value is empty.

Macro Name

Description

attAlias

Attribute dialog: Alias

attallowDuplicates

Attribute Detail dialog: Allow Duplicates checkbox

attClassifierGUID

The unique GUID for the classifier of the current attribute.

attCollection

Attribute Detail dialog: Attribute is a Collection checkbox

attConst

Attribute dialog: Const checkbox

attContainerType

Attribute Detail dialog: Container Type

attContainment

Attribute dialog: Containment

attDerived

Attribute dialog: Derived checkbox

attGUID

The unique GUID for the current attribute.

attInitial

Attribute dialog: Initial

attLength

Column dialog: Length

attLowerBound

Attribute Detail dialog: Lower Bound

attName

Attribute dialog: Name

attNotes

Attribute dialog: Notes

attOrderedMultiplicity

Attribute Detail dialog: Ordered Multiplicity checkbox

attProperty

Attribute dialog: Property checkbox

attQualType

The attribute type qualified by the namespace path (if generating namespaces) and the classifier path (dot delimited). If the attribute classifier has not been set, is equivalent to the attType macro.

attScope

Attribute dialog: Scope

attStatic

Attribute dialog: Static checkbox

attStereotype

Attribute dialog: Stereotype

attType

Attribute dialog: Type

attUpperBound

Attribute Detail dialog: Upper Bound

attVolatile

Attribute Detail dialog: Transient checkbox

classAbstract

Class dialog: Abstract checkbox

classAlias

Class dialog: Alias

classArguments

Class Detail dialog: C++ Templates: Arguments

classAuthor

Class dialog: Author

classBaseName

Type Hierarchy dialog: Class Name (for use where no link exists between child and base class).

classBaseScope

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

classBaseVirtual

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

classComplexity

Class dialog: Complexity

classGUID

The unique GUID for the current class.

classHasParent

True, if the class in scope has one or more base classes.

classImports

Code Gen dialog: Imports.

classIsActive

Class Advanced dialog: Is Active checkbox

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 dialog: Keywords

classLanguage

Class dialog: Language

classMacros

A space separated list of macros defined for the class.

classMultiplicity

Class Advanced dialog: Multiplicity

className

Class dialog: Name

classNotes

Class dialog: Note

classParamDefault

Class Detail dialog

classParamName

Class Detail dialog

classParamType

Class Detail dialog

classPersistence

Class dialog: Persistence

classPhase

Class dialog: Phase

classQualName

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

classScope

Class dialog: Scope

classStereotype

Class dialog: Stereotype

classStatus

Class dialog: Status

classVersion

Class dialog: Version

connectorAlias

Connector properties: Alias

connectorDestAccess

Connector target role properties: Access

connectorDestAggregation

Connector target role properties: Aggregation

connectorDestAlias

Connector target role properties: Alias

connectorDestAllowDuplicates

Connector target role properties: Allow Duplicates

connectorDestChangeable

Connector target role properties: Changeable

connectorDestConstraint

Connector target role properties: Constraint

connectorDestContainment

Connector target role properties: Containment

connectorDestDerived

Connector target role properties: Derived

connectorDestDerivedUnion

Connector target role properties: DerivedUnion

connectorDestElem*

For any class substitution macro that is supported, get the same information about the element at the target end of the connector.

connectorDestElemType

The element type of the connector destination element.

connectorDestMemberType

Connector target role properties: Member Type

connectorDestMultiplicity

Connector target role properties: Multiplicity

connectorDestNavigability

Connector target role properties: Navigability

connectorDestNotes

Connector target role properties: Notes

connectorDestOrdered

Connector target role properties: Multiplicity is Ordered

connectorDestOwned

Connector target role properties: Owned

connectorDestQualifier

Connector target role properties: Qualifier

connectorDestRole

Connector target role properties: Role

connectorDestScope

Connector target role properties: Target Scope

connectorDestStereotype

Connector target role properties: Stereotype

connectorDirection

Connector properties: Direction

connectorEffect

Transition Constraints dialog: Effect

connectorGuard

Object Flow and Transition Constraints dialog: Guard

connectorGUID

The unique GUID for the current connector.

connectorName

Connector properties: Name

connectorNotes

Connector properties: Notes

connectorSourceAccess

Connector source role properties: Access

connectorSourceAggregation

Connector source role properties: Aggregation

connectorSourceAlias

Connector source role properties: Alias

connectorSourceAllowDuplicates

Connector source role properties: Allow Duplicates

connectorSourceChangeable

Connector source role properties: Changeable

connectorSourceConstraint

Connector source role properties: Constraint

connectorSourceContainment

Connector source role properties: Containment

connectorSourceDerived

Connector source role properties: Derived

connectorSourceDerivedUnion

Connector source role properties: Derived Union

connectorSourceElem*

For any class substitution macro that is supported, get the same information about the element at the source end of the connector.

connectorSourceElemType

The element type of the connector source element.

connectorSourceMemberType

Connector source role properties: Member Type

connectorSourceMultiplicity

Connector source role properties: Multiplicity

connectorSourceNavigability

Connector source role properties: Navigability

connectorSourceNotes

Connector source role properties: Notes

connectorSourceOrdered

Connector source role properties: Multiplicity is Ordered

connectorSourceOwned

Connector source role properties: Owned

connectorSourceQualifier

Connector source role properties: Qualifier

connectorSourceRole

Connector source role properties: Role

connectorSourceScope

Connector source role properties: Target Scope

connectorSourceStereotype

Connector source role properties: Stereotype

connectorStereotype

Connector properties: Stereotype

connectorTrigger

Transition Constraints dialog: Trigger

connectorType

The connector type. eg. Association or Generalization.

connectorWeight

Object Flow Constraints dialog: Weight

eaDateTime

The current time with format: DD-MMM-YYYY HH:MM:SS AM/PM.

eaGUID

A unique GUID for this generation.

eaVersion

Program Version (Located in an Enterprise Architect dialog by selecting Help | About EA.)

elemType

The element type: Interface or Class.

fileExtension

The file type extension of the file being generated.

fileName

The name of the file being generated.

fileNameImpl

The filename of the implementation file for this generation, if applicable.

fileHeaders

Code Gen dialog: Headers

fileImports

Code Gen dialog: Imports. For supported languages this also includes dependencies derived from associations.

filePath

The full path of the file being generated.

filePathImpl

The full path of the implementation file for this generation, if applicable.

genOptActionScriptVersion

ActionScript Specifications dialog: Default Version

genOptCDefaultAttributeType

C Specifications dialog: Default Attribute Type

genOptCGenMethodNotesInBody

C Specifications dialog: Method Notes In Implementation

genOptCGenMethodNotesInHeader

C Specifications dialog: Method Notes In Header

genOptCSynchNotes

C Specifications dialog: Synchronize Notes in Generation

genOptCSynchCFile

C Specifications dialog: Synchronise Implementation file in Generation

genOptCDefaultSourceDirectory

C Specifications dialog: Default Source Directory

genOptCNamespaceDelimiter

C Specifications dialog: Namespace Delimiter

genOptCOperationRefParam

C Specifications dialog: Reference as Operation Parameter

genOptCOperationRefParamStyle

C Specifications dialog: Reference Parameter Style

genOptCOperationRefParamName

C Specifications dialog: Reference Parameter Name

genOptCConstructorName

C Specifications dialog: Default Constructor Name

genOptCDestructorName

C Specifications dialog: Default Destructor Name

genOptCPPCommentStyle

C++ Specifications dialog: Comment Style

genOptCPPDefaultAttributeType

C++ Specifications dialog: Default Attribute Type

genOptCPPDefaultReferenceType

C++ Specifications dialog: Default Reference Type

genOptCPPDefaultSourceDirectory

C++ Specifications dialog: Default Source Directory

genOptCPPGenMethodNotesInHeader

C++ Specifications dialog: Method Notes In Header checkbox

genOptCPPGenMethodNotesInBody

C++ Specifications dialog: Method Notes In Body checkbox

genOptCPPGetPrefix

C++ Specifications dialog: Get Prefix

genOptCPPHeaderExtension

C++ Specifications dialog: Header Extension

genOptCPPSetPrefix

C++ Specifications dialog: Set Prefix

genOptCPPSourceExtension

C++ Specifications dialog: Source Extension

genOptCPPSynchCPPFile

C++ Specifications dialog: Synchronize Notes

genOptCPPSynchNotes

C++ Specifications dialog: Synchronize CPP File

genOptCSDefaultAttributeType

C# Specifications dialog: Default Attribute Type

genOptCSSourceExtension

C# Specifications dialog: Default file extension

genOptCSGenDispose

C# Specifications dialog: Generate Dispose

genOptCSGenFinalizer

C# Specifications dialog: Generate Finalizer

genOptCSGenNamespace

C# Specifications dialog: Generate Namespace

genOptCSDefaultSourceDirectory

C# Specifications dialog: Default Source Directory

genOptDefaultAssocAttName

Attribute Specifications dialog: Default name for associated attrib

genOptDefaultConstructorScope

Object Lifetimes dialog: Default Constructor Visibility

genOptDefaultCopyConstructorScope

Object Lifetimes dialog: Default Copy Constructor Visibility

genOptDefaultDatabase

Code Editors dialog: Default Database

genOptDefaultDestructorScope

Object Lifetimes dialog: Default Destructor Constructor Visibility

genOptGenCapitalisedProperties

Source Code Engineering dialog: Capitalize Attribute Names for Properties checkbox

genOptGenComments

Source Code Engineering dialog: Generate Comments checkbox

genOptGenConstructor

Object Lifetimes dialog: Generate Constructor checkbox

genOptGenConstructorInline

Object Lifetimes dialog: Constructor Inline checkbox

genOptGenCopyConstructor

Object Lifetimes dialog: Generate Copy Constructor checkbox

genOptGenCopyConstructorInline

Object Lifetimes dialog: Copy Constructor Inline checkbox

genOptGenDestructor

Object Lifetimes dialog: Generate Destructor checkbox

genOptGenDestructorInline

Object Lifetimes dialog: Destructor Inline checkbox

genOptGenDestructorVirtual

Object Lifetimes dialog: Virtual Destructor checkbox

genOptGenImplementedInterfaceOps

Attribute/Operations Specifications dialog: Generate methods for implemented interfaces checkbox

genOptGenPrefixBoolProperties

Source Code Engineering dialog: Use is prefix for boolean property Get()

genOptGenRoleNames

Source Code Engineering dialog: Autogenerate role names when creating code

genOptGenUnspecAssocDir

Source Code Engineering dialog: Do not generate members where Association direction is unspecified checkbox

genOptJavaDefaultAttributeType

Java Specifications dialog: Default attribute type

genOptJavaGetPrefix

Java Specifications dialog: Get Prefix

genOptJavaDefaultSourceDirectory

Java Specifications dialog: Default Source Directory

genOptJavaSetPrefix

Java Specifications dialog: Set Prefix

genOptJavaSourceExtension

Java Specifications dialog: Source code extension

genOptPHPDefaultSourceDirectory

PHP Specifications dialog: Default Source Directory

genOptPHPGetPrefix

PHP Specifications dialog: Get Prefix

genOptPHPSetPrefix

PHP Specifications dialog: Set Prefix

genOptPHPSourceExtension

PHP Specifications dialog: Default file extension

genOptPHPVersion

PHP Specifications dialog: PHP Version

genOptPropertyPrefix

Source Code Engineering dialog: Remove prefixes when generating Get/Set properties

genOptVBMultiUse

VB Specifications dialog: Multiuse checkbox

genOptVBPersistable

VB Specifications dialog: Persistable checkbox

genOptVBDataBindingBehavior

VB Specifications dialog: Data binding behavior checkbox

genOptVBDataSourceBehavior

VB Specifications dialog: Data source behavior checkbox

genOptVBGlobal

VB Specifications dialog: Global namespace checkbox

genOptVBCreatable

VB Specifications dialog: Creatable checkbox

genOptVBExposed

VB Specifications dialog: Exposed checkbox

genOptVBMTS

VB Specifications dialog: MTS Transaction Mode

genOptVBNetGenNamespace

VB.Net Specifications dialog: Generate Namespace

genOptVBVersion

VB Specifications dialog: Default Version

genOptWrapComment

Source Code Engineering dialog: Wrap length for comment lines

importClassName

The name of the class being imported.

importFileName

The filename of the class being imported.

importFilePath

The full path of the class being imported.

importFromAggregation

T if the class has an aggregation link to a class in this file, F otherwise.

importFromAssociation

T if the class has an association link to a class in this file, F otherwise.

importFromAtt

T if an attribute of a class in the current file is of the type of this class, F otherwise.

importFromDependency

T if the class has an dependency link to a class in this file, F otherwise.

importFromGeneralization

T if the class has an generalization link to a class in this file, F otherwise.

importFromMeth

T if a method return type of a class in the current file is the type of this class,  Fotherwise.

importFromParam

T if an method parameter of a class in the current file is of the type of this class,  Fotherwise.

importFromRealization

T if the class has an realization link to a class in this file, F otherwise.

importInFile

T if the class is in the current file, F otherwise.

importPackagePath

The package path with a '.' separator of the class being imported.

ImportRelativeFilePath

The relative file path of the class being imported from the file path of the file being generated.

linkAttAccess

Association Properties Target Role dialog: Access

linkAttCollectionClass

The collection appropriate for the linked attribute in scope

linkAttContainment

Association Properties Target Role dialog: Containment

linkAttName

Association Properties dialog: Target

linkAttNotes

Association Properties Target Role dialog: Role Notes

linkAttQualName

The Association target qualified by the namespace path (if generating namespaces) and the classifier path (dot delimited).

linkAttRole

Association Properties Target Role dialog: Role

linkAttStereotype

Association Properties Target Role dialog: Stereotype

linkAttTargetScope

Association Properties Target Role dialog: Target Scope

linkCard

Link Properties Target Role dialog: Multiplicity

linkGUID

The unique GUID for the current link

linkParentName

Generalization Properties dialog: Target

linkParentQualName

The Generalization target qualified by the namespace path (if generating namespaces) and the classifier path (dot delimited).

linkStereotype

The stereotype of the current link.

linkVirtualInheritance

Generalization Properties dialog: Virtual Inheritance

opAbstract

Operation dialog: Virtual checkbox

opAlias

Operation dialog: Alias

opBehavior

Operation Behavior dialog: Behavior

opCode

Operation Behavior dialog: Initial Code

opConcurrency

Operation dialog: Concurrency

opConst

Operation dialog: Const checkbox

opGUID

The unique GUID for the current operation

opImplMacros

A space separated list of macros defined in the implementation of this operation.

opIsQuery

Operation dialog: IsQuery checkbox

opMacros

A space separated list of macros defined in the declaration for this operation

opName

Operation dialog: Name

opNotes

Operation dialog: Notes

opPure

Operation dialog: Pure checkbox

opReturnArray

Operation dialog: Return Array checkbox

opReturnClassifierGUID

The unique GUID for the classifier of the current operation.

opReturnQualType

The operation return type qualified by the namespace path (if generating namespaces) and the classifier path (dot delimited). If the return type classifier has not been set, is equivalent to the opReturnType macro.

opReturnType

Operation dialog: Return Type

opScope

Operation dialog: Scope

opStatic

Operation dialog: Static checkbox

Operation dialog: Stereotype

Operation dialog: Stereotype

opSynchronized

Operation dialog: Synchronized checkbox

packageAbstract

Package dialog: Abstract

packageAlias

Package dialog: Alias

packageAuthor

Package dialog: Author

packageComplexity

Package dialog: Complexity

packageGUID

The unique GUID for the current package.

packageKeywords

Package dialog: Keywords

packageLanguage

Package dialog: Language

packageName

Package dialog: Name

packagePath

The string representing the hierarchy of packages, for the class in scope. Each package name is separated by a dot (.)

packagePhase

Package dialog: Phase

packageScope

Package dialog: Scope

packageStatus

Package dialog: Status

packageStereotype

Package dialog: Stereotype

packageVersion

Package dialog: Version

paramClassifierGUID

The unique GUID for the classifier of the current parameter.

paramDefault

Operation Parameters dialog: Default

paramFixed

Operation Parameters dialog: Fixed checkbox

paramGUID

The unique GUID for the current parameter.

paramIsEnum

True, if the parameter uses the enum keyword (C++).

paramKind

Operation Parameters dialog: Kind

paramName

Operation Parameters dialog: Name

paramNotes

Operation Parameters dialog: Notes

paramQualType

The parameter type qualified by the namespace path (if generating namespaces) and the classifier path (dot delimited). If the parameter classifier has not been set, is equivalent to the paramType macro.

paramType

Operation Parameters dialog: Type

Field substitution macros can be used in one of two ways:

Use 1: Direct Substitution

This form directly substitutes the corresponding value of the element in scope into the output.

Structure: %<macroName>%

Where <macroName> can be any of the macros listed above.

Examples:

·%className%
·%opName%
·%attName%

Use 2: Conditional Substitution

This form of the macro enables alternative substitutions to be made depending on the macro's value.

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

Where:

·[ <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 is replaced with the macro's value in the output.

Examples:

·%classAbstract=="T" ? "pure" : ""%
·%opStereotype=="operator" ? "operator" : ""%
·%paramDefault != "" ? " = " value : ""%

The above three examples output nothing if the condition fails.  In this case the false condition can be omitted, resulting in the following usage:

Examples:

·%classAbstract=="T" ? "pure"%
·%opStereotype=="operator" ? "operator"%
·%paramDefault != "" ? " = " value%

The third example of both blocks shows a comparison checking for a non-empty value or existence.  This test can also be omitted.

·%paramDefault ? " = " value : ""%
·%paramDefault ? " = " value%

All of the above examples containing paramDefault are equivalent.  If the parameter in scope had a default value of 10, the output from each of them would normally  be:

= 10

Note: In a conditional substitution macro, any white space following <macroName> is ignored. If white space is required in the output, it should be included within the quoted substitution strings.