UML 2.1 to Java

From AcceleoWiki

Jump to: navigation, search
Module UML 2.1 to Java
Image:ModuleIncubation.png
Status: Incubation
Licence: EPL
Target: Java
Metamodel: UML 2.1
Inital contributor: CEA
Obeo
Contact: Gonzague Reydet



This project aims to generate Java applications from UML 2.1 models.

Contents

Guidelines

  • Easy to use
  • Standard UML input model (no complex UML profile)

Features

  • Java files generated from model elements:
    • Classes
    • Interfaces
    • Enumerations
  • Generated files respect the package structure
  • Comments generated from comment model elements
  • Association management
  • Generalization management
  • Interface realization management
  • Accessors generation

Planned features

  • Implementation of abstract methods from interface realizations and inherited abstract class
  • Method return generation
  • Constructors generation

Installation

The installation process is described on the installing a module web page.

Contribute!

How to use the generator?

Create a Module Launcher Chain

In a project (Java project), containing thbahe input UML model, clic on "New > Other..." and select "Module Launcher" on the Acceleo folder:
Image:1-ModuleLauncherCreation.png

Then, select the UML 2.1 to Java generation module:
Image:2-JavaGenerationModuleSelection.png‎

Then, give a name to your new chain:
Image:3-JavaChainName.png

Finally, enter the 3 parameters required by this generation module:

  • The error log file
  • The output source folder
  • The input UML model

Image:4-JavaModuleParameters.png

Launch the generation

To launch the generation process, right click on the chain, then "Launch":
Image:5-JavaLaunchGeneration.png

Upon the generation process completed, the generated sources should appear on the specified output folder.

Optional parameters

Several parameters can be set to personalize the generation:

Property name Description Default value
tuple.genArrays Set the representation of multiple attributes. Can be either arrays or collections false
tuple.ordered.class Set the class used for ordered collections java.util.ArrayList
tuple.notOrdered.class Set the class used for not ordered collections java.util.HashSet
gen.accessors Enable/Disable accessor generation (get/set) true
gen.listAccessors Enable/Disable list accessor generation (add/remove) true
gen.biDirections Enable/Disable bi-directionality generation true
gen.comment.date Enable/disable the date/time generation in code heading comments true

To precise such parameters to the generation module, add a property file (with .properties extension) next to the chain you created to launch the generation. For example, you can create a file UML2Java.properties with the following content:

# Generate arrays instead of collections
tuple.genArrays=true

# Don't generate accessors
gen.genAccessors=false
# Don't add generation date and time in code heading comments
gen.comment.date=false
Personal tools