Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dijagram klasa: UML to JAVA

Similar presentations


Presentation on theme: "Dijagram klasa: UML to JAVA"— Presentation transcript:

1 Dijagram klasa: UML to JAVA
Prof. dr Angelina Njeguš Associate Professor

2 Korak 1: Kreiraj UML projekat
File > New > Project Check Show all wizards Expand Modelling folder, select UML Project, and click Next Choose a name for your project and click Next. Project name: Bank

3 Korak 2: Kreiraj paket Select General > Blank Package
Choose a name for your package  and click Finish. File name: BankAccount What is package? A package is a general purpose mechanism for organising elements into groups. Packages may be nested within other packages.

4 Korak 3: Nacrtaj dijagram klasa
In the Project Explorer View, right click on the package BankAccount and select Add Diagram > Class diagram In the Palette view, click on Class, and name it Account Right click on Account, and select Add UML > Attribute Name the attribute: -balance : double, and click Enter.

5 Dodavanje operacija Right click on class Account, and select Operation
Name the operation: deposit(amount:double):double, and click Enter Add another operation: withdrawal(amount:double):double

6 Dodavanje novih klasa Add new class: CheckingAccount
Attribute: insufficientFundsFee:double Operation: withdrawal(amount:double) Add new class SavingsAccount Attribute: annualInterestRate:integer Operations: depositMonthlyInterest(), and withdrawal(amount:double)

7 Dodavanje relacija In the Pallete View, under Class, select Generalization, and draw on the diagram

8 Korak 4: UML-to-Java transformacija
To create a new UML-to-Java transformation configuration, select Modeling >Transform > New Configuration in the Main menu.

9 Configure the transformation
In the Name field of the opened New Transformation Configuration wizard, enter the name of the transformation configuration: Name: MyUMLtoJavaTransform Click the ellipses (...) button to browse to the UML project Bank In the list of deployed transformations, open the Java Transformations folder and select the UML-to-Java transformation. Select the Conceptual protocol type, and click Next. Note: Choose Conceptual protocol if the intention is to use the source model as a primary engineering artifact in future iterative development. Any changes made to the source model will be propagated to the target project when someone runs the transformation.

10 Specify the source and target elements for the transformation
Select the model BankAccount from the created UML project as a source Select Create a Target Container

11 Create a new Java project
Create a new Java project named myBankCode, and click Finish  Select it as a target in the Transformation Configuration wizard, and click Finish

12 Run the transformation configuration
The Java project and transformation configuration files created are visible in the Project Explorer view The Transformation configuration is opened in the Editor view Click Run to run the configuration

13 Generated transformation output
The Java code will be generated in the target project 


Download ppt "Dijagram klasa: UML to JAVA"

Similar presentations


Ads by Google