Doclet & Parser··Java

PlantUML Parser

A Java library to generate UML diagrams from Java packages.

PlantUML Parser is a Java library designed to automatically generate UML class diagrams from Java source packages.
Built as a custom Javadoc Doclet, it integrates seamlessly into Java documentation workflows to extract structure, associations, and dependencies — and outputs them as PlantUML (.puml) files ready for rendering.


Project Overview

This project started as an academic challenge to explore Javadoc’s Doclet API and automate reverse-engineering UML diagrams directly from Java codebases.

The result is a flexible command-line tool and API that can:

  • Parse classes, interfaces, enums, and packages
  • Detect inheritance, implementations, and aggregations
  • Recognize dependencies and usages
  • Include Javadoc comments and annotations in UML output
  • Offer fine-grained customization via CLI options and config files

The library can be used standalone or integrated into build tools (e.g. Maven, Gradle) to keep UML diagrams synchronized with code.


Technical Details

Technologies

Java

Core language used to build the Doclet API and handle parsing logic.

PlantUML

Used as the output format for generating visual UML diagrams.

Javadoc Doclet API

Enables direct access to Java’s syntax tree and metadata during documentation generation.

Command Line Interface

Provides a lightweight tool (Java2Puml) to generate diagrams with custom options and configurations.


Architecture

The library is built around a modular structure:

  • PumlDoclet — Core entry point for Javadoc, handling parsing and configuration.
  • Java2Puml — Command-line utility that runs the Doclet and produces .puml output.
  • PumlWriter — Handles UML syntax generation and file writing.
  • CreateFic — Manages output file creation and directory structure.
  • Package, Classe, Interface, Enum — Represent parsed Java elements and their relationships.
  • Config — Central configuration system with command-line and file-based options.

Each module was designed for reusability and extensibility, making it possible to integrate with other tools or modify the diagram generation logic.


My Role

As Lead Developer, I was responsible for the entire architecture, implementation, and feature set of the library.

Core contributions

  • Designed and implemented the Doclet-based parser
  • Developed the UML generation engine (DCA and DCC modes)
  • Implemented detection of classes, interfaces, enums, attributes, and methods
  • Added support for extends, implements, and non-primitive type associations
  • Integrated Javadoc comment parsing into the UML output
  • Created CLI options:
    • --out, --d for output file/directory
    • --dca / --dcc to switch diagram modes
    • --use to include dependency relationships
    • --str to treat String as a primitive type
    • --config to load configuration from a file
  • Implemented configuration and validation system for flexible diagram generation

Features

Automatic UML Generation
Extracts complete structure and relationships from Java packages into PlantUML syntax.

Customizable Output
CLI options and config files let you include/exclude methods, attributes, associations, and more.

Supports DCA & DCC Diagrams
Generates both simplified and detailed UML class diagrams.

Dependency Detection
Detects and visualizes uses, aggregations, and compositions between classes.

Javadoc Integration
Parses comments and tags like @pumlNameAssociation, @pumlUse, @pumlMultiplicity to enrich diagrams.

Recursive Package Handling
Automatically processes nested packages to generate global project diagrams.