An open API service indexing awesome lists of open source software.

https://github.com/jboz/plantuml-builder

Plantuml diagram from java sources
https://github.com/jboz/plantuml-builder

java maven maven-plugin plantuml

Last synced: 8 months ago
JSON representation

Plantuml diagram from java sources

Awesome Lists containing this project

README

          

ifdef::env-github[:toc: macro]
ifndef::env-site[:toc: preamble]
ifndef::imagesdir[:imagesdir: images]
:icons: font
:source-highlighter: coderay
:source-language: asciidoc

image:https://img.shields.io/badge/PRs-welcome-brightgreen.svg["Make a pull request", link="http://makeapullrequest.com"]
image:https://img.shields.io/github/license/spotify/dockerfile-maven.svg[License]
image:https://maven-badges.herokuapp.com/maven-central/ch.ifocusit/plantuml-builder/badge.svg?style=flat["Maven Central", link="https://maven-badges.herokuapp.com/maven-central/ch.ifocusit/plantuml-builder"]

= Plantuml builder

A tools to generate plantuml diagram from java sources.

This tool is an important part of the https://github.com/jboz/living-documentation[Living Documentation tool].

Using a builder pattern, the class `ClassDiagramBuilder` give you many way to construct and customize the diagram.

== Class diagram example

This code :
[source,java]
----
String diagram = new ClassDiagramBuilder()
.addClasses(Vehicule.class, Car.class, Driver.class, Price.class, Wheel.class, Devise.class)
.build();
----

Will generate this :

[source]
----
@startuml

interface Vehicule

class Car {
brand : String
model : String
driver : Driver
price : Price
wheels : Collection
}

class Driver {
name : String
cars : List
}

class Price {
amount : BigDecimal
devise : Devise
}

class Wheel

enum Devise {
CHF
EUR
USD
}

Vehicule <|-- Car
Car "*" <-> Driver : driver
Car --> Price : price
Car --> "*" Wheel : wheels
Price --> Devise : devise

@enduml
----

And if you render an image from this previous text file you will get :

image::class-diagram.png[Asciidoctor Diagram classes diagram]

=== For more uses cases and more options see https://github.com/jboz/plantuml-builder/blob/master/src/test/java/ch/ifocusit/plantuml/classdiagram/ClassDiagramBuilderTest.java[**ClassDiagramBuilderTest**] or https://github.com/jboz/plantuml-builder/blob/master/src/test/java/ch/ifocusit/plantuml/PlantUmlBuilderTest.java[**PlantUmlBuilderTest**] classes