You can find these options at the OptionsProjectCode EngineeringJava Language Options.


Java language options

Generate Opening Bracket In New Line

By default is turned on. If element (Java type or operation) is generated for the first time into source, curly bracket is generated from the new line, if options is on, or in the same line as declaration header ends, if option is off.

Generate Spaces

By default it is turned on. If option is on - adds additional space after open bracket and before close bracket in parameter declaration list.

Generate Empty Documentation

By default is turned off. If option is turned on, MagicDraw is generating documentation to the source even, if there are no documentation in model. Just adds Java documentation start and ending symbols.

Here is generated class header with options turned on. UML Class A doesn’t have documentation, but still in code is added documentation elements.

/* * 
 * 
 */
class A

Automatic “import“ Generation

By default is turned on. If option is turned on, all required imports are added automatically by used references on code generation. If this option is off, than imports are managed by user using specific mapping, see Imports.

Note, that if option is turned off, than no imports are created automatically and all imports, retrieved from source code on reverse engineering, are mapped into UML relationships as described in Imports.

Class Count To Generate Import On Demand

By default value is 10. It means, that if there will be 9 references from the same package to different types, then imports will be generated explicitly to these classes, but if there will be 10 and more references, than it will be generated one import to the package.

This option is valid only, when “Automatic import generation“ is turned on.

Documentation

Java documentation has two options by itself. It has Processor and Style. Style is used to define how to format documentation by adding some comments.

There are predefined two styles:

  • Style 1
/* * 
 *
 */
  • Style 2
 /* * 
 * 
 */

Processor is responsible for analyzing documentation context. There are two types <none> and Java Doc. <none> options does nothing with documentation and just set it as is on element.

Java Doc is processing documentation by resolving parameter tags or on code generation building documentation by collecting comments from the UML Parameters and adding missed tags for thrown exceptions or return.

There are additional Java Doc options (button “...”). These options can be used to declare what tags would not be generated or what order to use on code generation or perhaps to add some additional tag to documentation for all elements.

Note, that Java Doc processor splits operation documentation for UML Parameter and UML Operation on source code reverse and on code generation UML Parameter documentation is used to build Java documentation for operation.

Classpath

You can define classpath here by referencing jar files or class files directories.

This options is used by Java reverse engineering. If referenced element is not found in model for some reasons, that it is searched in this defined path. And if class is matched by name, this class is added into model.

By default, MagicDraw imports boot classpath of the JVM, on which is running.

Java Source

By default is Java 5.0. There are options 1.4 and 5.0. If you are reversing older specification source code, where, for example “enum“ is not a keyword and can be a variable name, then you will need to choose 1.4 Java source, else MagicDraw parser can emit error.

Header

It is a header for a newly generated Java files. There can be added some template string which will be preprocessed on writing to source code.

Template Strings
$FILE_NAMEFile name, without a path
$DATESystem date
$TIMESystem time
$AUTHORUser name on the system

Related Pages: