Now open Subscribe now · Free 30-day trial from 1 November See pricing → FR EN
CARTANO

Canvases · UML 2.5

From UML class diagram to Java or TypeScript code

The Cartano UML workshop draws a UML 2.5 class diagram in your browser and turns it into code in one click: the class skeleton in Java or TypeScript, or PlantUML text. The code is recomputed every time you open it and never stored, so it cannot drift from the diagram. Five other diagrams of the standard complete the workshop.

What a class diagram settles

A UML class diagram fixes the structure of software before it is written: which classes, which attributes and operations, which inheritance, association or composition relationships. It is the most used diagram of the UML standard.

Its value collapses when it is out of date. Hence the point of starting from the diagram to produce the code, rather than maintaining the two side by side.

How it works in Cartano

The Classes canvas offers four kinds of classifier (class, abstract class, interface, enumeration) and six relationships: association, aggregation, composition, generalization, realization, dependency. Each member has a visibility, a name and a type; associations carry multiplicities and roles.

The Code button, at the top of the document, opens the generated code, with three tabs:

  • Java: classes, abstract classes, interfaces, enumerations, extends and implements, attributes and operation signatures;
  • TypeScript: the same structure, with export class, interface and enum;
  • PlantUML: the diagram as text, associations and multiplicities included.
Cartano screen: a UML 2.5 class diagram for fleet management with the classes Vehicle, Contract, Assignment, Driver, an enumeration and event classes linked by inheritance relationships.
The class diagram of the demo example: 10 objects and 10 relationships.

What the generated code contains, and what it does not

You get a skeleton faithful to the structure: the classes, their inheritance, their attributes and their operations, with empty bodies to fill in. The code copies in one click, and it is recomputed the next time you open it if the diagram changed.

A note in the window says so: the code is a pure function of the model, recomputed each time it is opened and never stored.

Cartano screen: the “Generated code” window on the Java tab, showing Java classes with their attributes, empty operations and extends links to an abstract class.
The Java code generated from the example diagram: classes, inheritance, attributes, operations to write.

The other diagrams, and the agent draft

The UML workshop has six canvases from the 2.5 standard: classes, use cases, components, packages, sequence and state machine. A class cites its package by reference, never by retyped text.

On the Studio plan, the agent workshop offers a “Data Architect” that drafts a class diagram from a plain-language need, and a use-case expert. The agent proposes a draft, and nothing enters the model without your agreement.

Frequently asked questions

How do I generate Java code from a class diagram?

Draw the diagram in the Classes canvas, then click “Code” at the top of the document and pick the Java tab. Cartano generates classes, interfaces and enumerations with their inheritance, attributes and operation signatures, with empty bodies.

Can I generate TypeScript?

Yes, it is the second tab of the “Generated code” window: export class, interface and enum, with extends and implements.

Can I export to PlantUML?

Yes, for a class diagram: the third tab gives PlantUML text with the classes, their members and their relationships, multiplicities included. The other UML diagrams have no PlantUML export.

Which UML 2.5 diagrams are covered?

Six: classes, use cases, components, packages, sequence and state machine. The other types in the standard are not offered, apart from activity (through BPMN) and deployment (through the Technology canvas).

Can an AI agent draft the diagram?

Yes, on the Studio plan: the “Data Architect” drafts a class diagram from a need described in business language, and another agent drafts use cases. It is a draft: you review it, and you accept or refuse.

Can I get my diagram out without Cartano?

Yes. The diagram exports as an image (PNG or SVG) and the document can be committed to a Git repository, as readable JSON files. The PlantUML text copies from the code window.

Watch it run, rather than read about it.

A 30-day trial with no credit card on the Solo and Atelier plans. Or thirty minutes of demo, on your own cases.