Applying the Java transformation

You can apply the Java™ transformation to an entire model or subset of model elements to generate Java classes from the source elements.

Before you apply the Java transformation, you should read the information available at Modeling > Transform > Configure Transformations. In the Transformations/Configurations list, click UML to Java, on the Transformation Description page, click View Transformation Documentation.
To apply the Java transformation:
  1. In the Model Explorer view, select the model elements or model that you want to convert to Java classes.
    Note: A model element that is contained within another model element, such as a component or collaboration, will not be transformed unless it is specifically selected.
  2. Right-click the selected model or model elements; then complete one of the following steps:
    • To run a new transformation configuration, click Transform > Run Transform > UML to Java.
    • To run an existing transformation configuration, click the name of the transformation configuration.
  3. To create a new target Java project, complete the following steps:
    1. In the Run Transformation window, click the Target tab.
    2. On the Target page, click Create new Target Container.
    3. In the New Project wizard, in the Project name box, type a name.
    4. Click Finish.
  4. Select a target from the list.
  5. To specify the Java collection types that the transformation generates, click the Collections tab.
  6. On the Collections page, in each UML collection type list, click a Java collection type.
  7. To replace transformed model elements with shortcuts to generated Java elements, complete the following steps:
    1. Click the Common tab.
    2. On the Common page, click Replace UML elements.
    Note: The transformation does not replace model elements if data will be lost.
  8. To create derived relationships from generated Java elements to their UML source model element, complete the following steps:
    1. Click the Common tab.
    2. On the Common page, click Create source to target relationships.
  9. Click Run.
The transformation generates Java classes in the target Java project. The Java project and Java classes are displayed in the Model Explorer view.

Parent topic: Generating Java classes from a model

Related concepts
Java transformation

Related reference
Installed transformations

Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.