Java Round-Trip Engineering in Visual Paradigm Desktop

Java Round-Trip Engineering in Visual Paradigm Desktop enables developers to synchronize Java source code with UML class models. It supports both directions of synchronization: generating Java source code from UML class diagrams and reverse engineering existing Java source code into UML class models. By merging changes between the model and implementation, Java Round-Trip helps developers maintain consistency between software design and source code throughout the development lifecycle.

What Is Java Round-Trip Engineering?

Java Round-Trip Engineering is a code engineering feature in Visual Paradigm Desktop that establishes synchronization between a UML class model and its corresponding Java source code. It allows developers to generate Java classes from UML models, reverse engineer Java code into UML classes, and update either representation when changes are made.

Unlike one-way code generation, Java Round-Trip supports an ongoing model-to-code and code-to-model workflow. Developers can begin with a UML class diagram, generate Java source files, implement business logic in their preferred development environment, and subsequently reverse engineer the modified source code to update the UML model.

Similarly, when the UML model is changed, developers can generate or update the corresponding Java source files without treating the existing implementation as disposable output. Visual Paradigm merges changes during round-trip synchronization, helping preserve existing implementation code.

The two primary synchronization directions are:

  • UML to Java: Generate or update Java source code based on UML class models.
  • Java to UML: Reverse engineer Java source code to create or update UML class models.

Both directions work together to maintain a consistent relationship between software design and implementation.

Why Is Java Round-Trip Engineering Essential?

Java Round-Trip addresses a common software development challenge: keeping design documentation synchronized with an evolving codebase. When developers maintain UML diagrams and Java source code separately, the two representations can gradually become inconsistent as the application changes.

For example, a developer may add a new operation to a Java class but forget to update the corresponding UML class diagram. Alternatively, a software architect may modify the class model without updating the implementation. Over time, the UML model becomes outdated and less useful as a reference for understanding the system.

Java Round-Trip reduces this problem by providing a synchronization workflow between the two representations.

Maintain consistency between design and implementation

Developers can update the UML class model from Java source code or update Java source code from the UML model. This makes it easier to keep architectural documentation aligned with the actual implementation.

Preserve existing implementation code

When updating generated Java code, Visual Paradigm uses round-trip synchronization to merge changes instead of treating the operation as a simple replacement of generated files. This is particularly useful when developers have added method implementations and other code after initially generating the source files.

Support iterative software development

Software design is rarely finalized before implementation begins. Classes, attributes, operations, and relationships frequently change as requirements evolve. Java Round-Trip allows developers to continue refining the UML model and Java implementation throughout successive development iterations.

Reverse engineer existing Java applications

Developers do not need to start with a UML model. They can reverse engineer an existing Java codebase to produce UML class models, making it easier to understand legacy applications, investigate dependencies, and document existing software architectures.

Improve software documentation

By updating UML class models from source code, developers can maintain a more accurate visual representation of the implementation. These diagrams can support technical documentation, architecture reviews, maintenance activities, and knowledge transfer.

Work with large Java codebases efficiently

For projects containing many source files, Visual Paradigm provides on-demand reverse engineering. Instead of immediately creating UML elements for every source file, developers can index the source code and reverse engineer only the classes they need.

Edition and Availability

Java Round-Trip Engineering is available in Visual Paradigm Desktop Standard Edition, Professional Edition, and Enterprise Edition.

Visual Paradigm Desktop Edition Java Round-Trip Engineering
Enterprise Supported
Professional Supported
Standard Supported
Modeler Not included
Community Not included

Java Round-Trip is a code engineering capability rather than a general UML diagramming function. Having access to UML class diagrams does not necessarily mean that the corresponding code engineering features are available in the selected edition.

Java Round-Trip Functionality Breakdown

Java Round-Trip in Visual Paradigm Desktop consists of several related capabilities. The following sections explain the main functions, synchronization directions, configuration options, and supported workflows.

Generate Java Code from UML Class Models

Java code generation converts UML class models into Java source files. Developers can define the structure of their application visually using UML class diagrams and then generate corresponding Java classes.

The generated source code reflects the structural information defined in the UML model, including supported class declarations, attributes, operations, relationships, and other model properties.

Visual Paradigm supports three ways to generate or update Java code:

  • Whole-project generation: Generate Java code for classes throughout the current Visual Paradigm project.
  • Class-diagram generation: Generate Java code associated with the classes represented in an open class diagram.
  • Selected-class generation: Generate Java code for one or more selected classes.

These approaches allow developers to choose the scope of code generation according to their development needs.

Generate Java Code for the Whole Project

Whole-project generation allows developers to generate or update Java source files for all applicable classes in the current Visual Paradigm project.

This approach is useful when initially generating an application structure or synchronizing a larger UML model with its Java implementation.

Developers can configure mappings between UML models and Java source folders. Multiple mappings can be defined to organize generated code according to the structure of the UML project.

Generate Java Code from a Class Diagram

Visual Paradigm allows developers to generate or update Java code from an open UML class diagram.

This approach is useful when working on a particular subsystem or functional area and when only the classes represented in a specific diagram need to be processed.

To initiate diagram-based generation, right-click the background of an open class diagram and select Utilities > Java Round-trip > Generate Code.

The generation process uses the configured model-to-source-path mapping. Importantly, the source folder is associated with a UML model, not directly with an individual diagram.

Generate Java Code from Selected Classes

Developers can also generate Java code for specific UML classes without processing the entire project or relying on an open diagram as the generation scope.

To use this approach, select one or more classes in a class diagram, right-click the selection, and choose Java Round-trip > Generate Code.

This is particularly useful when making focused changes to individual classes or a small group of related classes.

Reverse Engineer Java Code into UML Class Models

Java-to-UML reverse engineering analyzes Java source code and creates or updates corresponding UML class models in Visual Paradigm.

Instead of manually recreating an existing application’s class structure, developers can use reverse engineering to extract the model from the source code.

This capability supports two important scenarios:

  • Initial reverse engineering: Create UML classes from an existing Java codebase.
  • Model synchronization: Update previously reversed UML classes to reflect subsequent changes in Java source files.

Reverse engineering is useful when documenting existing applications, recovering architectural information, or maintaining UML models for systems that are primarily developed through source code.

Source-Path-to-Model Mapping

When reversing Java source code, Visual Paradigm allows developers to define mappings between source folders and UML models.

A source-path-to-model mapping determines where the reversed UML classes should be placed in the Visual Paradigm project.

For example, developers may organize reversed classes into different UML models according to their source locations or application layers:

  • Source folder src/domain mapped to the Domain model.
  • Source folder src/service mapped to the Service model.
  • Source folder src/controller mapped to the Controller model.

Multiple source-path-to-model mappings can be defined using the Add button in the Reverse Code dialog.

If the project does not use separate UML models for organizing classes, developers can use <root> as the target model.

The mapping controls also allow developers to remove an existing mapping or change the order of mappings using the Move Up and Move Down controls.

On-Demand Reverse Engineering

On-demand reverse engineering allows developers to index Java source files without immediately creating UML class elements for every class in the source code.

This is particularly useful for large Java applications containing thousands or even millions of source files, where reversing the entire codebase at once could take considerable processing time and produce an unnecessarily large UML model.

When the Reverse source on demand option is enabled, Visual Paradigm creates indexes of the source files and presents them in the Class Repository.

Developers can then select specific classes from the index tree and reverse only the resources they need.

The indexed classes can be reversed into UML classes using the Reverse Resources command. The available destinations include:

  • New Class Diagram: Reverse the selected resources into UML classes and create a new class diagram containing those classes.
  • Class Repository: Reverse the selected resources into UML classes in the Class Repository.

This approach makes it possible to explore and selectively model large Java codebases without immediately importing their entire class structure into the UML model.

Important: On-demand reverse engineering and immediate reverse engineering are different processing modes. If developers want the UML model to be updated directly during the reverse operation, they should uncheck Reverse source on demand.

Update UML Models from Java Code

After the initial round-trip configuration has been established, developers can update existing UML classes to reflect changes made in Java source code.

Visual Paradigm provides two convenient ways to perform this update:

  • Update classes in a diagram: Right-click the background of a class diagram and select Utilities > Java Round-trip > Reverse Code.
  • Update selected classes: Select the UML classes that need updating, right-click the selection, and choose Java Round-trip > Reverse Code.

These contextual commands are available after round-trip engineering has been performed at least once. The diagram-based operation also requires the class diagram to contain at least one class.

This functionality is useful when developers make implementation changes in their IDE and want the corresponding UML class model to reflect those changes without manually editing the diagram.

Synchronize Java Code and UML Models

Synchronization is the central capability of Java Round-Trip. It allows developers to update either the Java implementation or the UML class model while maintaining their relationship.

For example, consider a UML class named Employee that has been used to generate a Java source file named Employee.java.

After generation, a developer adds a new operation called createEmployee() to the Java class.

By performing reverse code synchronization, Visual Paradigm can update the corresponding UML class to include the new operation.

Alternatively, if the developer adds another operation to the UML class, Java code generation can update the corresponding source file.

Visual Paradigm’s round-trip approach merges changes between the model and source code rather than treating every synchronization operation as a simple one-way replacement.

Multiple Source and Model Mappings

Both code generation and reverse engineering support multiple mappings.

For code generation, a model-to-source-path mapping determines the destination folder for Java files generated from a particular UML model.

For reverse engineering, a source-path-to-model mapping determines the destination UML model for classes extracted from a particular source folder.

These mappings are useful when a Java application and its corresponding UML project contain multiple packages, modules, or logical subsystems.

They also help developers maintain a more organized relationship between the source-code folder structure and the UML model hierarchy.

Ignore Classes During Code Generation

The Ignore Classes option allows developers to exclude selected UML classes from Java code generation.

This is useful when a UML project contains classes that should not have corresponding generated Java source files.

To configure the ignore list, click Ignore Classes… in the Generate Code dialog. Select the classes that should be excluded and use the right-arrow control to move them into the ignore list. Click OK to confirm the selection.

Ignored classes are excluded from the code generation operation.

Advanced Code Generation Options

Visual Paradigm provides an Advanced Options dialog that allows developers to customize the generated Java code and synchronization behavior.

The settings are organized into four categories: Code, Brace and Indentation, New Lines, and Template.

Code Options

The Code category controls how UML model elements are translated into Java declarations and source-code constructs.

Option Description
Default attribute type Specifies the Java type assigned to an attribute when its type is not specified in the UML model. The documented default is int.
Default operation return type Specifies the return type assigned to an operation when its return type is unspecified. The documented default is void.
Default parameter type Specifies the type assigned to an operation parameter when its type is unspecified. The documented default is int.
Auto realize interface Controls whether operations defined in an interface are generated in implementing subclasses. The documented default is disabled.
Remove method body after changed to abstract method Controls whether the existing method body is removed when an operation changes from non-abstract to abstract. The documented default is enabled.
Use “is” prefix for getters that return boolean Controls whether getters for boolean attributes use the is prefix, such as isActive(). The documented default is enabled.
Add import statement instead of using fully qualified type name Controls whether referenced classes are imported instead of being referenced using fully qualified type names. The documented default is enabled.
Import fully qualified type name for referenced type Controls whether imports use fully qualified type names instead of wildcard imports. The documented default is disabled.
Java Collection Determines whether one-to-many relationships are generated as arrays or collections. Collection is the documented default.
Use generic collections Controls whether generated collections use Java generics. The documented default is enabled.
Generate annotation on Specifies whether annotations are generated on property methods or fields.
Generate annotation in code convention Controls annotation generation according to the code convention. The documented default is enabled.
Text File Encoding Determines the encoding used for generated source files. Developers can use the system default encoding or specify another encoding.

Brace and Indentation Options

The Brace and Indentation category controls the formatting of generated Java source code.

Developers can configure brace placement independently for the following declarations:

  • Class declarations.
  • Constructor declarations.
  • Method declarations.
  • Enum declarations.
  • Annotation type declarations.

For each declaration type, the opening brace can appear on the same line as the declaration or on the following line.

The indentation policy can also be configured to use either tabs or spaces. When spaces are selected, developers can specify the indentation size.

These options allow generated code to follow the formatting conventions used by a development team.

New Lines Options

The New Lines category controls the number of blank lines inserted at different locations in generated Java source files.

Available settings include:

  • Before package declaration.
  • After package declaration.
  • Before import declaration.
  • After import declaration.
  • Before first declaration.
  • Before different kind declaration.
  • Before field declaration.
  • Before method declaration.
  • Before inner type declaration.
  • Number of lines in an empty method body.

These settings provide control over source-code spacing and readability.

Template Options

The Template category allows developers to customize the code generated for operations, getters, and setters.

Template Purpose
Operation Template Defines the template for method bodies generated for UML operations.
Getter Template Defines the template used when generating getter methods.
Setter Template Defines the template used when generating setter methods.

Getter and setter methods are generated for attributes stereotyped as Property or for which the corresponding property getter or setter option has been selected.

These templates provide additional flexibility when generated Java code needs to follow particular implementation conventions.

Generate Model Descriptions as Java Comments

Visual Paradigm can generate descriptions defined in UML model elements as comments in the corresponding Java source code.

This allows developers to document classes and other model elements in the UML environment and carry the descriptions into generated source files.

It is useful for maintaining consistency between design documentation and source-code documentation.

Command-Line Java Code Synchronization

Visual Paradigm also provides a JavaCodeSync script for performing Java code synchronization through the command line.

This provides an alternative to manually initiating synchronization through the Visual Paradigm user interface and can be useful in scripted development workflows.

The documented procedure is:

  1. Locate the JavaCodeSync script in the scripts folder under the Visual Paradigm installation directory.
  2. Copy the script into the Visual Paradigm installation’s bin folder.
  3. Open a command prompt or terminal.
  4. Navigate to the installation’s bin folder.
  5. Execute the script with the required project, source-folder, and synchronization-direction parameters.

For macOS, the scripts folder can be located inside the Visual Paradigm application package. Right-click the application, select Show Package Contents, and navigate to Contents/Resources/app/scripts.

The documented command-line parameters are:

Parameter Description
-project Specifies the path to the Visual Paradigm project file.
-src Specifies the folder containing the Java source files.
-generate Updates Java source code from the UML model.
-reverse Updates the UML model from Java source code.

Example command for generating Java code from the UML model:

JavaCodeSync -project C:\Demo\Demo.vpp -src C:\Demo\MyProject\src -generate

To reverse Java source code into the UML model, replace -generate with -reverse.

The command-line workflow provides a way to invoke model-to-code or code-to-model synchronization without manually opening the corresponding synchronization dialog.

How to Use Java Round-Trip Engineering

The following workflows explain how to use Java Round-Trip in Visual Paradigm Desktop, from initial code generation to subsequent synchronization.

Workflow: Generate Java Code from a UML Class Model

Use this workflow when you have designed your application using UML class diagrams and want to generate the corresponding Java source files.

  1. Open your Visual Paradigm project.
  2. Create or open the UML class diagram containing the classes for which you want to generate Java code.
  3. From the main menu, select Tools > Code > Generate Java Code….
  4. In the Generate Code dialog, specify the model-to-source-path mapping. Select the UML model and the destination folder for the generated Java source files.
  5. If necessary, add additional mappings using the Add button.
  6. Optionally, click Advanced Options… to configure Java code generation settings.
  7. Optionally, click Ignore Classes… to exclude specific classes from code generation.
  8. Click OK to generate the Java source files.

Visual Paradigm generates the Java source files in the specified destination folders. The model-to-source-path configuration establishes the relationship used for subsequent synchronization.

Workflow: Generate Code from a Specific Class Diagram

Use this workflow when you want to generate code associated with an open class diagram.

  1. Open the desired UML class diagram.
  2. Right-click the diagram background.
  3. Select Utilities > Java Round-trip > Generate Code.
  4. In the Generate Code dialog, review or specify the model-to-source-path mapping.
  5. Configure advanced options if necessary.
  6. Click OK to proceed.

Note: The source path is associated with the UML model containing the classes, not directly with the diagram. If you have previously performed code generation, the Generate Code dialog may not appear again for diagram-based generation. To change mappings or generation settings, initiate project-level code generation.

Workflow: Generate Code from Selected Classes

Use this workflow when only specific UML classes need to be generated or updated.

  1. Open a class diagram containing the required classes.
  2. Select one or more UML classes.
  3. Right-click the selected classes.
  4. Select Java Round-trip > Generate Code.
  5. Review the source-path mapping if the Generate Code dialog is displayed.
  6. Configure advanced options if necessary.
  7. Click OK to generate or update the corresponding Java source files.

This approach allows developers to work on selected classes without initiating a whole-project generation operation.

Workflow: Reverse Engineer Java Source Code into UML

Use this workflow when you have an existing Java codebase and want to create UML class models from its source files.

  1. Open the Visual Paradigm project where the reversed UML classes should be stored.
  2. Select Tools > Code > Reverse Java Code… from the main menu.
  3. In the Reverse Code dialog, specify the source-path-to-model mapping.
  4. Use the Add button to define additional mappings if necessary.
  5. Choose the appropriate target UML model for each source folder. Use <root> if you do not need to organize the reversed classes under a specific model.
  6. Determine whether to use on-demand reverse engineering. Uncheck Reverse source on demand if you want the UML classes to be reversed directly into the model.
  7. Click OK to begin reverse engineering.

After immediate reverse engineering, the corresponding UML classes are available in the Visual Paradigm project and can be used to create or update class diagrams.

Workflow: Update a UML Model After Changing Java Code

Use this workflow when you have already established round-trip synchronization and have subsequently modified Java source files.

  1. Open the Java source files in your preferred IDE or text editor.
  2. Make the required changes to the Java implementation, such as adding attributes, operations, or modifying existing class declarations.
  3. Save the modified Java source files.
  4. Return to Visual Paradigm Desktop.
  5. Select Tools > Code > Reverse Java Code… from the main menu.
  6. Verify the source-path-to-model mapping.
  7. Uncheck Reverse source on demand if you want the UML model to be updated directly rather than merely creating source indexes.
  8. Click OK to perform the reverse synchronization.

Visual Paradigm updates the corresponding UML classes to reflect the changes detected in the Java source code.

Workflow: Update Java Code After Changing the UML Model

Use this workflow when you have modified the UML class model and want the corresponding Java implementation to reflect those changes.

  1. Open your Visual Paradigm project.
  2. Modify the required UML classes, attributes, operations, or relationships.
  3. From the main menu, select Tools > Code > Generate Java Code….
  4. Verify the existing model-to-source-path mapping.
  5. Review advanced code generation options if necessary.
  6. Click OK to generate or update the Java source files.

Visual Paradigm synchronizes the Java source code with the updated UML model while merging changes through the round-trip process.

Workflow: Reverse Selected Classes from a Large Java Codebase

Use this workflow when a Java application contains a large number of source files but you only need to model selected classes.

  1. Select Tools > Code > Reverse Java Code….
  2. Define the source-path-to-model mapping for the Java source folders.
  3. Ensure that Reverse source on demand is checked.
  4. Click OK to build the source indexes.
  5. Open the Class Repository and locate the indexed Java classes.
  6. Browse the index tree and select the classes you want to reverse.
  7. Right-click the selected resources and choose Reverse Resources.
  8. Select either New Class Diagram or Class Repository as the destination.

Visual Paradigm reverses the selected resources into UML classes without requiring the entire Java codebase to be immediately converted into UML elements.

Java Round-Trip Dialog Reference

This section summarizes the main controls developers encounter when configuring Java Round-Trip operations.

Generate Code Dialog

Control Purpose
Language Specifies the programming language for code generation. For this workflow, the language is Java.
Add mapping (+) Adds a new UML model-to-source-path mapping.
Remove mapping (-) Removes the selected mapping.
Move Up Moves the selected mapping one position upward.
Move Down Moves the selected mapping one position downward.
Model-to-source-path mapping Displays the configured UML models and their corresponding Java output folders.
Advanced Options… Opens the Code Synchronization dialog for configuring code generation, formatting, and templates.
Ignore Classes… Opens the class exclusion configuration.
OK Starts the code generation or update operation.
Cancel Closes the dialog without starting the operation.

Reverse Code Dialog

Control Purpose
Language Specifies the programming language of the source code to reverse.
Add mapping (+) Adds a new source-path-to-model mapping.
Remove mapping (-) Removes the selected mapping.
Move Up Moves the selected mapping one position upward.
Move Down Moves the selected mapping one position downward.
Source-path-to-model mapping Displays the source folders and their corresponding destination UML models.
Reverse source on demand Creates source indexes rather than immediately reversing all source files into UML classes.
OK Starts the reverse engineering operation.
Cancel Closes the dialog without starting the operation.

Practical Use Cases and Development Scenarios

Design-first development

A software architect creates UML class diagrams to define the initial structure of an application. The development team generates Java source files from the model and continues implementation in an IDE. As the design evolves, the UML model and Java code are synchronized through Java Round-Trip.

Code-first development

A development team has already implemented an application in Java but lacks accurate UML documentation. The team reverse engineers the existing source code to create UML class models and uses those models for architecture documentation and subsequent design discussions.

Maintaining legacy applications

When maintaining an older Java application, developers may need to understand class structures and dependencies before modifying the system. Reverse engineering provides a way to recover the UML class model from the implementation.

Collaborative software development

Different team members may focus on different parts of the development process. Architects can modify UML models while developers implement business logic in Java. Round-trip synchronization provides a mechanism for reconciling changes between these activities.

Working with large enterprise systems

Enterprise applications often contain extensive Java codebases. On-demand reverse engineering allows developers to index source files and selectively reverse the classes needed for a particular investigation or development task.

Keeping technical documentation current

When implementation changes are made directly in Java, developers can reverse the updated source code into UML models. This helps keep technical diagrams useful as documentation of the evolving application.

Best Practices for Java Round-Trip Engineering

Establish the mapping before synchronization

Configure the correct model-to-source-path or source-path-to-model mappings before performing synchronization. This helps Visual Paradigm associate the appropriate UML models with the correct Java source folders.

Use consistent model and package organization

Organize UML models and Java source folders according to the application’s logical structure. Multiple mappings can be used to maintain clear relationships between different modules.

Choose the appropriate synchronization scope

Use whole-project generation for broad updates, diagram-based generation for a particular class diagram, and selected-class generation for focused changes.

Use on-demand reverse engineering for large projects

When working with extensive source code, consider enabling Reverse source on demand. This allows you to inspect and selectively reverse classes rather than immediately creating a complete UML representation.

Configure code generation conventions early

Review the advanced settings for imports, collection types, annotations, brace placement, indentation, and templates. Establishing consistent settings early helps generated source files follow the development team’s coding conventions.

Use UML descriptions to support code documentation

Add meaningful descriptions to UML model elements. Visual Paradigm can generate these descriptions as comments in the corresponding Java source code.

Understand the difference between round-trip and instant generation

Use Java Round-Trip when the objective is to maintain synchronization between an evolving UML model and Java implementation. Do not confuse it with one-time code generation or instant reverse engineering, which serve different purposes.

Java Round-Trip vs. Instant Generator and Instant Reverse

Visual Paradigm provides different code engineering approaches, and it is important to understand their purposes.

Capability Java Round-Trip Instant Generator / Instant Reverse
Primary purpose Maintain synchronization between UML models and Java source code. Perform one-time code generation or reverse engineering.
UML to Java Generates or updates Java source files. Generates Java source files as a one-off operation.
Java to UML Creates or updates UML classes through synchronization. Creates UML models from source code through instant reverse engineering.
Ongoing synchronization Supports synchronization in both directions. Not designed for ongoing model-code synchronization.
Implementation preservation Changes are merged through round-trip synchronization. Instant generation overwrites its target upon execution.
Typical use Iterative software development where UML and code evolve together. One-time source generation or source-code analysis.

Which should you use? Choose Java Round-Trip when you need to maintain an ongoing relationship between UML class models and Java source code. Choose Instant Generator or Instant Reverse when you only need to generate code or reverse engineer a model for a particular task without establishing an ongoing synchronization workflow.

Important Considerations

Java Round-Trip is primarily concerned with class-model synchronization

Java Round-Trip focuses on synchronizing UML class models and Java source code. It should not be confused with generating a complete, executable application from UML diagrams. Developers remain responsible for implementing application logic and handling the broader software development process.

Code generation settings affect generated output

Default types, collection settings, import behavior, annotation placement, formatting, and templates can affect the generated Java source files. Developers should review these settings when the generated code needs to follow specific project conventions.

On-demand reverse engineering does not immediately create all UML classes

When Reverse source on demand is enabled, Visual Paradigm indexes source files rather than immediately creating UML classes for the entire source folder. Developers must explicitly reverse the required resources from the Class Repository.

Source-path mappings determine synchronization locations

Incorrect mappings can associate UML models with unintended source folders or place reversed classes in the wrong UML model. Verify the mappings before starting a synchronization operation.

Round-trip engineering is not a substitute for source control

Although Java Round-Trip helps merge changes between UML models and Java source code, it does not replace version control, backup, code review, or team collaboration practices. Developers should maintain appropriate backups and source-control history when performing substantial synchronization operations.

Frequently Asked Questions About Java Round-Trip

What is Java Round-Trip in Visual Paradigm?

Java Round-Trip is a Visual Paradigm Desktop code engineering feature that synchronizes UML class models and Java source code. It allows developers to generate Java code from UML models and reverse engineer Java source code into UML classes, supporting updates in both directions.

Can Visual Paradigm generate Java code from a UML class diagram?

Yes. Visual Paradigm supports Java code generation from an entire project, an open class diagram, or selected UML classes. Generated Java source files are saved to the configured source folders.

Can I generate UML class diagrams from existing Java code?

Yes. Use Tools > Code > Reverse Java Code… to reverse engineer Java source code into UML classes. You can then use those classes to create or update UML class diagrams.

Can I update Java code after changing a UML class diagram?

Yes. Use Java Round-Trip code generation to update Java source files based on changes made to the UML class model.

Can I update a UML class diagram after modifying Java source code?

Yes. Use Java Round-Trip reverse engineering to update the UML model based on changes made in Java source files. You can reverse the entire configured source scope or update selected classes.

Will generating Java code overwrite my existing implementation?

Java Round-Trip is designed to merge changes between the UML model and Java source code rather than simply overwrite the implementation. This helps preserve existing implementation code when updating generated source files. This behavior distinguishes Java Round-Trip from one-time Instant Generator operations.

What is the difference between Generate Code and Reverse Code?

Generate Code updates Java source files based on the UML model. Reverse Code updates the UML model based on Java source files. They represent the two synchronization directions supported by Java Round-Trip.

What is the difference between Java Round-Trip and Instant Generator?

Java Round-Trip maintains synchronization between UML class models and Java source code. Instant Generator produces source code as a one-time operation and overwrites its target upon execution. Use Java Round-Trip when you need ongoing synchronization and want to preserve implementation changes.

What is the difference between Java Round-Trip and Instant Reverse?

Java Round-Trip reverses Java source code into UML classes as part of an ongoing synchronization workflow. Instant Reverse is intended for one-time reverse engineering and does not establish the same ongoing synchronization relationship.

Can I generate Java code for only selected classes?

Yes. Select the required UML classes in a class diagram, right-click them, and choose Java Round-trip > Generate Code.

Can I generate Java code for an entire Visual Paradigm project?

Yes. Select Tools > Code > Generate Java Code… to generate or update Java code for all applicable classes in the current project.

Can I reverse engineer only selected Java classes?

Yes. Enable Reverse source on demand when reversing a large source folder. Visual Paradigm creates source indexes in the Class Repository, allowing you to select specific resources and reverse them into UML classes.

What does Reverse source on demand mean?

Reverse source on demand means Visual Paradigm indexes Java source files instead of immediately creating UML classes for all of them. Developers can browse the index tree and selectively reverse the classes they need.

How do I reverse Java source code directly into UML classes?

Open Tools > Code > Reverse Java Code…, configure the source-path-to-model mapping, uncheck Reverse source on demand, and click OK. This performs immediate reverse engineering instead of creating only source indexes.

Why are my UML classes not updated after reverse engineering?

One possible reason is that Reverse source on demand is enabled. In this mode, Visual Paradigm indexes source files instead of immediately creating or updating UML classes. Uncheck the option and perform the reverse operation again if you want direct model updates.

What is the purpose of model-to-source-path mapping?

Model-to-source-path mapping tells Visual Paradigm where to generate Java source files for classes contained in a particular UML model. It allows different UML models to be associated with different Java source folders.

What is the purpose of source-path-to-model mapping?

Source-path-to-model mapping determines where UML classes extracted from a Java source folder should be stored in the Visual Paradigm project.

What does <root> mean in the mapping configuration?

<root> represents the root model of the Visual Paradigm project. Use it when you do not need to organize generated or reversed classes under a specific UML model.

Can I configure multiple source folders?

Yes. Visual Paradigm supports multiple model-to-source-path mappings for code generation and multiple source-path-to-model mappings for reverse engineering.

Can I exclude certain UML classes from Java code generation?

Yes. Click Ignore Classes… in the Generate Code dialog, select the classes you want to exclude, move them into the ignore list, and confirm the selection.

Can I customize the Java code generated by Visual Paradigm?

Yes. The Advanced Options dialog provides settings for default types, interface realization, getter naming, imports, collections, generics, annotations, text encoding, braces, indentation, blank lines, and code templates.

Can I customize generated getter and setter methods?

Yes. Use the Getter Template and Setter Template options in the Template category of the Advanced Options dialog. These templates apply to attributes configured as properties or with the corresponding getter and setter options.

Can I generate Java collections from UML relationships?

Yes. The Java Collection setting controls whether one-to-many relationships are generated as arrays or collections. Collection is the documented default, and generic collections can also be enabled.

Can Visual Paradigm generate comments from UML descriptions?

Yes. Descriptions defined in UML model elements are generated as comments in the corresponding Java source code.

Can I synchronize Java code without opening the Visual Paradigm user interface?

Yes. Visual Paradigm provides a JavaCodeSync command-line script. It accepts the Visual Paradigm project path, Java source folder, and synchronization direction through the -project, -src, -generate, and -reverse parameters.

Which Visual Paradigm editions support Java Round-Trip?

Java Round-Trip Engineering is supported in Visual Paradigm Desktop Standard, Professional, and Enterprise editions. It is not included in the Modeler or Community editions.

Does Java Round-Trip generate a complete executable Java application?

No. Java Round-Trip generates and synchronizes Java source code based on UML class models. Developers still need to implement business logic and complete the application development, compilation, testing, and deployment processes.

Can I use Java Round-Trip for an existing application without first creating UML diagrams?

Yes. You can start by reversing an existing Java codebase into UML class models. A pre-existing UML class diagram is not required to begin reverse engineering.

Summary

Java Round-Trip Engineering in Visual Paradigm Desktop provides a two-way synchronization workflow between UML class models and Java source code. It supports whole-project, diagram-based, and selected-class code generation, as well as immediate and on-demand reverse engineering.

With configurable source-path mappings, class exclusions, advanced code generation settings, and command-line synchronization, developers can adapt the workflow to different application structures and development practices.

Whether starting with UML design, maintaining an existing Java application, or documenting a large codebase, Java Round-Trip helps keep software design and implementation aligned as a project evolves.

Scroll to Top