SlideShare a Scribd company logo
Mapeamento de UML -> JAVA
Como implementar Código JAVA a partir de
algumas notações UML.
// Notes will be used in the
// rest of the presentation
// to contain Java code for
// the attached UML elements
public class Course
{
Course() { }
protected void finalize()
throws Throwable {
super.finalize();
}
};
Course
Representação de notas
public class Student
{
private String name;
public void addSchedule (Schedule theSchedule; Semester forSemester) {
}
public boolean
hasPrerequisites(CourseOffering forCourseOffering) {
}
protected boolean
passed(CourseOffering theCourseOffering) {
}
}
Visibilidade para Atributos e Operações
Student
- name : String
+ addSchedule (theSchedule: Schedule, forSemester: Semester)
+ hasPrerequisites(forCourseOffering: CourseOffering) : int
# passed(theCourseOffering: CourseOffering) : int
class Student
{
private static int nextAvailID = 1;
public static int getNextAvaiIID() {
}
}
Escopo de atributos, operações e classes
Student
- nextAvailID : int = 1
+ getNextAvaiIID() : int
<<utility>>
MathPack
-randomSeed : long = 0
-pi : double = 3.14159265358979
+sin (angle : double) : double
+cos (angle : double) : double
+random() : double
import java.lang.Math;
import java.util.Random;
class MathPack
{
private static randomSeed long = 0;
private final static double pi =
3.14159265358979;
public static double sin(double angle) {
return Math.sin(angle);
}
static double cos(double angle) {
return Math.cos(angle);
}
static double random() {
return new
Random(seed).nextDouble();
}
}
void somefunction() {
. . .
myCos = MathPack.cos(90.0);
. . .
Classe utilitária
Outer
Outer::Inner
class Outer
{
public outer() { }
class Inner {
public Inner() { }
}
}
Inner Class
Schedule
Student
class Student
{
public Student() { }
private Schedule theSchedule;
}
// no need to import if in same package
class Schedule
{
public Schedule() { }
private Student theStudent ;
}
Associações
 Bi-direcional
Schedule
Student
class Student
{
public Student() { }
private Schedule theSchedule;
}
class Schedule
{
public Schedule() { }
}
Navegabilidade
 Uma direção
Professor
CourseOffering
instructor
class Professor
{
public Professor() {}
private CourseOffering theCourseOffering;
}
class CourseOffering
{
public CourseOffering() {}
private Professor instructor;
}
Regras nas associações
CourseOffering
Schedule
class Schedule
{
public Schedule() {}
private CourseOffering[] primaryCourses =
new CourseOffering[4]
}
class CourseOffering
{
public CourseOffering() {}
}
0..4 primaryCourses
Associações múltiplas
// No need to import if in the same package
class PrimaryScheduleOfferingInfo
{
public PrimaryScheduleOfferingInfo() {}
public CourseOffering get_theCourseOffering(){
return theCourseOffering;
}
public void set_theCourseOffering(CourseOffering toValue){
theCourseOffering = toValue;
}
private char get_Grade (){ return grade; }
private void set_Grade(char toValue) { grade = toValue; }
private char grade = ‘I’;
private CourseOffering theCourseOffering;
}
Classe associativa
Schedule CourseOffering
0..4
0..*
primaryCourses
PrimaryScheduleOfferingInfo
- grade: char = I
alternateCourses
0..2
0..*
0..*
Schedule CourseOffering
1
1 0..4
0..2
0..*
alternateCourses
primaryCourseOfferingInfo PrimaryScheduleOfferingInfo
- grade: char = I
Design Decisions
Course
prerequisites
0..* import java.util.Vector;
class Course
{
public Course() {}
// The unbounded multiple association
// is stored in a vector
private Vector prerequisites;
}
Associação reflexiva
Schedule
Student
class Schedule
{
public Schedule() { }
private Student theStudent;
}
0..*
1 import java.util.Vector;
class Student
{
public Student() { }
private Vector theSchedule;
}
Agregação
Schedule
Student
class Schedule
{
public Schedule() { }
private Student theStudent;
}
0..*
1
import java.util.Vector;
class Student
{
public Student() { }
private Vector theSchedule = new Vector();
}
Composição
Serializable
<<Interface>>
Schedule
<<entity>>
interface Serializable {
}
class Schedule implements Serializable {
}
Interfaces and Realizações
GroundVehicle
class Truck extends GroundVehicle
{
public float tonnage;
public void getTax() { }
}
class GroundVehicle
{
public int licenseNumber;
public void register() { }
}
+licenseNumber: int
+register()
Truck
+tonnage: float
+getTax()
Generalização
Amphibious
Vehicle
<<Interface>>
IVehicle
<<Interface>>
IWaterVehicle
Land
Vehicle
{overlapping}
class AmphibiousVehicle
extends LandVehicle
implements WaterVehicle
{
. . .
}
<<realize>>
<<realize>>
interface IWaterVehicle :
implements IVehicle
{
. . .
}
Em Java, uma classe herda somente de
uma classe, porém, ela pode implementar
várias Interfaces.
Herança Múltipla
Herança múltipla (continuação)
AmphibiousVehicle
LandVehicle
IAmphibiousVehicle
<<Interface>>
IHobby
<<Interface>>
IWaterVehicle
<<Interface>>
ILandVehicle
<<Interface>>
In Java, a class can inherit
from one superclass.
It can, however implement
multiple interfaces.
An interface can inherit
from many interfaces.
abstract class Animal
{
public abstract void talk();
}
Animal
{abstract}
Lion
+talk()
Tiger
+talk()
class Tiger extends Animal
{
public Tiger() { }
public void talk() { }
}
+talk() {abstract}
Classe Abstrata
Set
T, n:int
<<bind>>
mySetOfFloats
insert(T)
remove(T)
<float, 100>
Java does not support parameterized classes
Classe Parametrizada
package CourseCatalog;
public interface ICourseCatalog {
public CourseOfferingList
getCourseOfferings();
}
CourseCatalog
<<subsystem>>
ICourseCatalog
Subsistemas

More Related Content

Similar to Mapeamento uml java

import school.; import school.courses.;public class Main { p.pdf
import school.; import school.courses.;public class Main { p.pdfimport school.; import school.courses.;public class Main { p.pdf
import school.; import school.courses.;public class Main { p.pdfannaiwatertreatment
 
Starting with Main.java, where I tested everythingimport College..pdf
Starting with Main.java, where I tested everythingimport College..pdfStarting with Main.java, where I tested everythingimport College..pdf
Starting with Main.java, where I tested everythingimport College..pdfaptind
 
DDD Modeling Workshop
DDD Modeling WorkshopDDD Modeling Workshop
DDD Modeling WorkshopDennis Traub
 
[PL] O klasycznej, programistycznej elegancji
[PL] O klasycznej, programistycznej elegancji[PL] O klasycznej, programistycznej elegancji
[PL] O klasycznej, programistycznej elegancjiJakub Marchwicki
 
#ifndef COURSES_H #define COURSES_H class Courses { privat.pdf
#ifndef COURSES_H #define COURSES_H class Courses { privat.pdf#ifndef COURSES_H #define COURSES_H class Courses { privat.pdf
#ifndef COURSES_H #define COURSES_H class Courses { privat.pdfanupambedcovers
 
OOPs Concepts - Android Programming
OOPs Concepts - Android ProgrammingOOPs Concepts - Android Programming
OOPs Concepts - Android ProgrammingPurvik Rana
 
C# Summer course - Lecture 4
C# Summer course - Lecture 4C# Summer course - Lecture 4
C# Summer course - Lecture 4mohamedsamyali
 
Code Smells y Refactoring o haciendo que nuestro codigo huela (y se vea) mejo...
Code Smells y Refactoring o haciendo que nuestro codigo huela (y se vea) mejo...Code Smells y Refactoring o haciendo que nuestro codigo huela (y se vea) mejo...
Code Smells y Refactoring o haciendo que nuestro codigo huela (y se vea) mejo....NET Conf UY
 
Best Core Java Training In Bangalore
Best Core Java Training In BangaloreBest Core Java Training In Bangalore
Best Core Java Training In Bangalorerajkamaltibacademy
 
Inheritance, polymorphisam, abstract classes and composition)
Inheritance, polymorphisam, abstract classes and composition)Inheritance, polymorphisam, abstract classes and composition)
Inheritance, polymorphisam, abstract classes and composition)farhan amjad
 
Dependency injection in scala
Dependency injection in scalaDependency injection in scala
Dependency injection in scalaMichal Bigos
 

Similar to Mapeamento uml java (20)

import school.; import school.courses.;public class Main { p.pdf
import school.; import school.courses.;public class Main { p.pdfimport school.; import school.courses.;public class Main { p.pdf
import school.; import school.courses.;public class Main { p.pdf
 
Starting with Main.java, where I tested everythingimport College..pdf
Starting with Main.java, where I tested everythingimport College..pdfStarting with Main.java, where I tested everythingimport College..pdf
Starting with Main.java, where I tested everythingimport College..pdf
 
DDD Modeling Workshop
DDD Modeling WorkshopDDD Modeling Workshop
DDD Modeling Workshop
 
[PL] O klasycznej, programistycznej elegancji
[PL] O klasycznej, programistycznej elegancji[PL] O klasycznej, programistycznej elegancji
[PL] O klasycznej, programistycznej elegancji
 
Jar chapter 5_part_i
Jar chapter 5_part_iJar chapter 5_part_i
Jar chapter 5_part_i
 
Unit-3 Practice Programs-5.docx
Unit-3 Practice Programs-5.docxUnit-3 Practice Programs-5.docx
Unit-3 Practice Programs-5.docx
 
#ifndef COURSES_H #define COURSES_H class Courses { privat.pdf
#ifndef COURSES_H #define COURSES_H class Courses { privat.pdf#ifndef COURSES_H #define COURSES_H class Courses { privat.pdf
#ifndef COURSES_H #define COURSES_H class Courses { privat.pdf
 
Apsec04.ppt
Apsec04.pptApsec04.ppt
Apsec04.ppt
 
Apsec04.ppt
Apsec04.pptApsec04.ppt
Apsec04.ppt
 
OOPs Concepts - Android Programming
OOPs Concepts - Android ProgrammingOOPs Concepts - Android Programming
OOPs Concepts - Android Programming
 
‫Chapter3 inheritance
‫Chapter3 inheritance‫Chapter3 inheritance
‫Chapter3 inheritance
 
C# Summer course - Lecture 4
C# Summer course - Lecture 4C# Summer course - Lecture 4
C# Summer course - Lecture 4
 
Unit 4 notes.pdf
Unit 4 notes.pdfUnit 4 notes.pdf
Unit 4 notes.pdf
 
Code Smells y Refactoring o haciendo que nuestro codigo huela (y se vea) mejo...
Code Smells y Refactoring o haciendo que nuestro codigo huela (y se vea) mejo...Code Smells y Refactoring o haciendo que nuestro codigo huela (y se vea) mejo...
Code Smells y Refactoring o haciendo que nuestro codigo huela (y se vea) mejo...
 
Best Core Java Training In Bangalore
Best Core Java Training In BangaloreBest Core Java Training In Bangalore
Best Core Java Training In Bangalore
 
Static keyword.pptx
Static keyword.pptxStatic keyword.pptx
Static keyword.pptx
 
Inheritance, polymorphisam, abstract classes and composition)
Inheritance, polymorphisam, abstract classes and composition)Inheritance, polymorphisam, abstract classes and composition)
Inheritance, polymorphisam, abstract classes and composition)
 
Chap-3 Inheritance.pptx
Chap-3 Inheritance.pptxChap-3 Inheritance.pptx
Chap-3 Inheritance.pptx
 
Dependency injection in scala
Dependency injection in scalaDependency injection in scala
Dependency injection in scala
 
OOP Lab Report.docx
OOP Lab Report.docxOOP Lab Report.docx
OOP Lab Report.docx
 

Recently uploaded

SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Krakówbim.edu.pl
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEJelle | Nordend
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownloadvrstrong314
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAlluxio, Inc.
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisNeo4j
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessWSO2
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandIES VE
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfMeon Technology
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAlluxio, Inc.
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAlluxio, Inc.
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowPeter Caitens
 

Recently uploaded (20)

SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysis
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdf
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 

Mapeamento uml java

Editor's Notes

  1. Appendix - UML to Java Mapping
  2. Appendix - UML to Java Mapping
  3. Appendix - UML to Java Mapping
  4. Appendix - UML to Java Mapping
  5. Appendix - UML to Java Mapping
  6. Appendix - UML to Java Mapping
  7. Appendix - UML to Java Mapping
  8. Appendix - UML to Java Mapping
  9. Appendix - UML to Java Mapping
  10. Appendix - UML to Java Mapping
  11. Appendix - UML to Java Mapping
  12. Appendix - UML to Java Mapping
  13. Appendix - UML to Java Mapping
  14. Appendix - UML to Java Mapping
  15. Appendix - UML to Java Mapping
  16. Appendix - UML to Java Mapping
  17. Appendix - UML to Java Mapping
  18. Appendix - UML to Java Mapping
  19. Appendix - UML to Java Mapping
  20. Appendix - UML to Java Mapping
  21. Appendix - UML to Java Mapping