How nxllxn/plantumlcodegenerator works
Project Type and Purpose
• This is an open-source Java CLI/library tool named PlantUmlCodeGenerator.
Key Modules (Top-Level Packages)
• com.nxllxn.plantuml.config
• ClassScannerConfiguration: holds scan settings (rootPackage, include/exclude filters).
• com.nxllxn.plantuml.scanner
• ClassScanner: uses configuration to discover classes and build AST-like Java model.
• com.nxllxn.plantuml.java
• Domain model for Java constructs (TopLevelClass, Method, Field, etc.).
• com.nxllxn.plantuml.codegen
• PlantUmlCodeGenerator: orchestrates scanning + assembly to produce a list of CompilationUnits.
• com.nxllxn.plantuml.service
• CodeAssembleService / TemplateBasedCodeAssembleServiceImpl: applies templates to model elements to generate PlantUML source lines.
• com.nxllxn.plantuml.writer
• AbstarctWriter, PrimitivePlantUmlCodeFileWriter: writes the raw .pu file.
• com.nxllxn.plantuml.utils
• Helpers (ConfigurationLoader, RegExpUtil, AssembleUtil).
External Dependencies
• Graphviz – native dot renderer, required by PlantUML for layout.
• Maven (pom.xml) – build, dependency management, test execution.
• CLI/Entry (App.java) – rectangle, labeled “Entry Point / CLI”
• Config Loader – hexagon or rectangle, “ConfigurationLoader”
• Class Scanner – rectangle, “ClassScanner”
• Java Model – package node grouping classes under java (CompilationUnit, Element…)
• Code Generator – rectangle, “PlantUmlCodeGenerator”
• Code Assembly Service – rectangle, “TemplateBasedCodeAssembleServiceImpl”
• Writers – two rectangles: “PrimitivePlantUmlCodeFileWriter” and “UmlDiagramWriter”
• Build System – small package “Maven / pom.xml”
1. App → ConfigurationLoader (loads scan settings)
2. App → ClassScanner (provides config) → returns list of Java model elements
3. App → PlantUmlCodeGenerator (uses scanner + service) → returns CompilationUnits
4. PlantUmlCodeGenerator → TemplateBasedCodeAssembleServiceImpl → generates PlantUML source strings
5. App → PrimitivePlantUmlCodeFileWriter (writes .pu) → File System
6. App → UmlDiagramWriter → PlantUML API → Graphviz → writes .png/.svg → File System
c. Architectural Patterns
• Modular pipeline: Configuration → Scanning → Modeling → Code Generation → Writing.
• Service abstraction (CodeAssembleService) allows swapping templates or assembly logic.
• Layered separation: config, scanner, model, generator, writer, utils.
d. Technologies & Frameworks
• Java 8+
• Maven (pom.xml)
• PlantUML (Java library)
• Graphviz (external process)
• JUnit (tests under src/main/test)