Marked Up Class to Service Transformation
This transformation accepts a top level UML class with a stereotype
ClassToService::service (or the keyword, service) and generates an interface,
an implementation class and a factory class by carrying out the following mappings:
- The attributes of the source class map to getter and setter methods in the interface and the implementation class.
- The public operations of the source class map to operations in the interface.
- The private and public operations of the source class map to operations in the implementation class.
- The attributes of the source class map to attributes of the implementation class.
- The factory class provides a method that creates and returns an instance of the implementation class.
- A ClassToService::create stereotype (or the keyword, create) on an operation causes the operation to be moved to the factory class.
A top level class is a class that is contained directly in a package or a model. An inner class which is
contained in another class is not a top level class.
If you choose a model or a package as the source, the transformation
generates output classes for each of the top level classes in the model or
the package.
This transformation uses a set of rules and sub-transforms to carry out the above mappings.
Running the Transformation
To run the transformation:
- Start the run-time workbench.
-
In the run-time workbench, create an UML model containing a class with a
few attributes and operations. This is your source model.
- In the run-time workbench, create another UML model with a package in it.
This is your target model.
- Apply the ClassToService profile to the source model.
- Apply the stereotype service to one or more classes in the source model.
-
Right-click a class, a package, or the model in the source model;
then click Transform > Run Transformation > Marked up Class to Service.
-
In the Run Transform window, on the Target page, select the package in the
target model or the target model itself.
- Click Run.
For each class with a stereotype ClassToService::service, the transformation generates the interface,
implementation and factory classes
and places them in the specified target package. If you choose the target model
on the Target page, the transformation places the generated classes in a package
named, ClassToServiceOutput, in the target model.
Transformation Details
Transformation Source
This transformation accepts a UML model or a package or a class as the source.
The model should have ClassToService profile applied to it.
Transformation Target
This transformation accepts a model or a package as its target.