Skip to content

jboz/plantuml-builder

Repository files navigation

Make a pull request License Maven Central

Plantuml builder

A tools to generate plantuml diagram from java sources.

This tool is an important part of the 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 :

String diagram = new ClassDiagramBuilder()
        .addClasses(Vehicule.class, Car.class, Driver.class, Price.class, Wheel.class, Devise.class)
        .build();

Will generate this :

@startuml

interface Vehicule

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

class Driver {
  name : String
  cars : List<Car>
}

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 :

Asciidoctor Diagram classes diagram

For more uses cases and more options see ClassDiagramBuilderTest or PlantUmlBuilderTest classes

About

Plantuml diagram from java sources

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages