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 .
In the Transformations/Configurations list,
click UML to Java, on the Transformation Description page,
click View Transformation Documentation.
To apply the Java transformation:
- 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.
- Right-click the selected model or model elements; then
complete one of the following steps:
- To run a new transformation configuration, click .
- To run an existing transformation configuration, click the
name of the transformation configuration.
- To create a new target Java project,
complete the following steps:
- In the Run Transformation window,
click the Target tab.
- On the Target page, click Create
new Target Container.
- In the New Project wizard, in
the Project name box, type a name.
- Click Finish.
- Select a target from the list.
- To specify the Java collection
types that the transformation generates, click the Collections tab.
- On the Collections page, in each
UML collection type list, click a Java collection
type.
- To replace transformed model elements with shortcuts
to generated Java elements,
complete the following steps:
- Click the Common tab.
- On the Common page, click Replace UML elements.
Note: The transformation does not replace
model elements if data will be lost.
- To create derived relationships from generated Java elements
to their UML source model element, complete the following steps:
- Click the Common tab.
- On the Common page, click Create source
to target relationships.
- 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.