Advanced Systems Design with Java, UML and MDA

Chapter 6: From Platform-Specific Models to Executable Code

Once a platform-specific design has been produced, it can be used as the basis for an implementation in executable code. In this chapter we show the mapping from a Java PSM to Java code. The process is similar for other related languages such as C++ or C #.

6.1 Production of a Java Implementation

Starting from the PSM diagrams and module descriptions, class definitions in Java can be produced, with some degree of automation. Each construct in the PSM class diagram needs to be mapped to a programming language construct. Table 6.1 lists the main correspondences for Java.

Table 6.1: Mapping of UML elements to Java

Class Diagram Element

Java Program Construct

class

class

abstract class

abstract class

interface

interface

guarded class

synchronised class

leaf class

final class

utility class

static class

inheritance

extends

interface inheritance

implements

static attribute

static (class) attribute

non-static attribute

instance attribute

readOnly attribute

final attribute

abstract operation

abstract method

static operation

static method

non-static operation

instance method

guarded operation

synchronised method

identity attribute

no direct translation

association

attribute of class/collection type

constraint

no direct translation

From this table it can be seen that most of the class diagram elements map quite directly to corresponding Java elements, merely with different keywords being used ( final instead of readOnly, etc). However the last three cases are more difficult. An identity attribute has the constraint that no two objects of the class can have the same value for it. This means that the constructor...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Integrated Development Environment (IDE)
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.