Prev Next

Notes on Source Code Import

You can import code into your Enterprise Architect project, in a range of programming languages. Enterprise Architect supports most constructs and keywords for each coding language. You select the appropriate type of source file for the language, as the source code to import.

If there is a particular feature you require support for that you feel is missing, please contact Sparx Systems.

Notes

  • When reverse engineering attributes with parameter substitutions (templated attributes):
         -  If a Class with proper template parameter definitions is found, an Association connector is
            created and its parameter substitutions are configured
         -  An Association connector is also created if a matching entry is defined as a Collection Class or
            in the 'Additional Collection Classes' option (for C#, C++ and Java); for an example, see Example
           Use of Collection Classes

Programming Language notes

Language

Notes

See also

ActionScript

Appropriate type of source file: .as code file.

ActionScript

C

Appropriate type of source file: .h header files and/or .c files.

When you select a header file, Enterprise Architect automatically searches for the corresponding .c implementation file to import, based on the options for extension and search path specified in the C options.

Enterprise Architect does not expand macros that have been used, these must be added into the internal list of Language Macros.

C C options Language Macros

C++

Appropriate type of source file: .h header file.

Enterprise Architect automatically searches for the .cpp implementation file based on the extension and search path set in the C++ options; when it finds the implementation file, it can use it to resolve parameter names and method notes as necessary.

When importing C++ source code, Enterprise Architect ignores function pointer declarations.

To import them into your model you could create a typedef to define a function pointer type, then declare function pointers using that type; function pointers declared in this way are imported as attributes of the function pointer type.

Enterprise Architect does not expand macros that have been used; these must be added into the internal list of Language Macros.

C++ C++ options Language Macros

C#

Appropriate type of source file: .cs.

C# C# Options

Delphi

Appropriate type of source file: .pas.

Delphi

Java

Appropriate type of source file: .java.

Enterprise Architect supports the AspectJ language extensions.

Aspects are modeled using Classes with the stereotype aspect; these aspects can then contain attributes and methods as for a normal Class.

If an intertype attribute or operation is required, you can add a tag 'className' with the value being the name of the Class it belongs to.

Pointcuts are defined as operations with the stereotype <<pointcut>>, and can occur in any Java Class, Interface or aspect; the details of the pointcut are included in the 'behavior' field of the method.

Advice is defined as an operation with the stereotype <<advice>>; the pointcut this advice operates on is in the 'behavior' field and acts as part of the method's unique signature.

afterAdvice can also have one of the Tagged Values returning or throwing.

Java Java Options

PHP

Appropriate type of source file: .php, .php4, or .inc.

Nested if condition syntax is enabled.

PHP

Python

Appropriate type of source file: .py.

Python

Visual Basic

Appropriate type of source file: .cls Class file.

Visual Basic

Visual Basic .NET

Appropriate type of source file: .vb Class file.

Visual Basic .NET

Learn more