All Projects → pierre3 → Plantumlclassdiagramgenerator

pierre3 / Plantumlclassdiagramgenerator

Licence: mit
This is a generator to create a class-diagram of PlantUML from the C# source code.

Labels

Projects that are alternatives of or similar to Plantumlclassdiagramgenerator

Grunt Md2html
Small Grunt MultiTask to convert Markdown files to HTML, supporting Grunt >= 1.0.0
Stars: ✭ 37 (-82.63%)
Mutual labels:  plantuml
Plantuml Service
High-performance HTTP service for PlantUML, used in Kibela
Stars: ✭ 86 (-59.62%)
Mutual labels:  plantuml
C4 Builder
This is a documentation builder. You feed it .md and .puml and it exports a site, pdf, or a markdown with navigation.
Stars: ✭ 164 (-23%)
Mutual labels:  plantuml
Pandoc Plantuml Filter
Pandoc filter for PlantUML code blocks
Stars: ✭ 51 (-76.06%)
Mutual labels:  plantuml
Markdeck
presentations as code - author cool slide decks, text-only, offline-ready, collaborative
Stars: ✭ 1,159 (+444.13%)
Mutual labels:  plantuml
Plantuml Previewer.vim
Vim / Neovim plugin for preview PlantUML
Stars: ✭ 119 (-44.13%)
Mutual labels:  plantuml
Swiftplantuml
A command-line tool and Swift Package for generating class diagrams powered by PlantUML
Stars: ✭ 34 (-84.04%)
Mutual labels:  plantuml
Hands On Devops
A hands-on DevOps course covering the culture, methods and repeated practices of modern software development involving Packer, Vagrant, VirtualBox, Ansible, Kubernetes, K3s, MetalLB, Traefik, Docker-Compose, Docker, Taiga, GitLab, Drone CI, SonarQube, Selenium, InSpec, Alpine 3.10, Ubuntu-bionic, CentOS 7...
Stars: ✭ 196 (-7.98%)
Mutual labels:  plantuml
Pandoc Plot
Render and include figures in Pandoc documents using your plotting toolkit of choice
Stars: ✭ 75 (-64.79%)
Mutual labels:  plantuml
Database To Plantuml
Compile PostgreSQL and MySQL table information into a PlantUML description.
Stars: ✭ 157 (-26.29%)
Mutual labels:  plantuml
Xstate Plantuml
Visualize a xstate or react-automata statechart as a plantuml state diagram
Stars: ✭ 52 (-75.59%)
Mutual labels:  plantuml
Plantuml Parser
Parse PlantUML with JavaScript or TypeScript
Stars: ✭ 67 (-68.54%)
Mutual labels:  plantuml
Umldoclet
Automatically generate PlantUML diagrams in javadoc
Stars: ✭ 138 (-35.21%)
Mutual labels:  plantuml
Lein Plantuml
A Leiningen plugin for generating UML diagrams using PlantUML
Stars: ✭ 43 (-79.81%)
Mutual labels:  plantuml
Go Plantuml
Generate plantuml diagrams from go source files or directories
Stars: ✭ 167 (-21.6%)
Mutual labels:  plantuml
Plantuml Styler
Online tool to make your PlantUML diagrams look great.
Stars: ✭ 35 (-83.57%)
Mutual labels:  plantuml
Asciidocfx
Asciidoc Editor and Toolchain written with JavaFX 16 (Build PDF, Epub, Mobi and HTML books, documents and slides)
Stars: ✭ 1,533 (+619.72%)
Mutual labels:  plantuml
Jekyll Spaceship
🚀 A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, mermaid, emoji, video, audio, youtube, vimeo, dailymotion, soundcloud, spotify, etc.
Stars: ✭ 196 (-7.98%)
Mutual labels:  plantuml
Cli
A command line utility for Structurizr.
Stars: ✭ 173 (-18.78%)
Mutual labels:  plantuml
Swagger to uml
Convert OpenAPI specifications (a.k.a. Swagger) to PlantUML diagrams
Stars: ✭ 144 (-32.39%)
Mutual labels:  plantuml

PlantUmlClassDiagramGenerator

This is a generator to create a class-diagram of PlantUML from the C# source code.

Visual Studio Code Extension

.Net Core global tools

Nuget Gallery: https://www.nuget.org/packages/PlantUmlClassDiagramGenerator

Installation

Download and install the .NET Core 2.1 SDK or newer. Once installed, run the following command.

dotnet tool install --global PlantUmlClassDiagramGenerator

Usage

Run the "puml-gen" command.

puml-gen InputPath [OutputPath] [-dir] [-public | -ignore IgnoreAccessibilities] [-excludePaths ExcludePathList] [-createAssociation]
  • InputPath: (Required) Sets a input source file or directory name.
  • OutputPath: (Optional) Sets a output file or directory name.
    If you omit this option, plantuml files are outputted to same directory as the input files.
  • -dir: (Optional) Specify when InputPath and OutputPath are directory names.
  • -public: (Optional) If specified, only public accessibility members are output.
  • -ignore: (Optional) Specify the accessibility of members to ignore, with a comma separated list.
  • -excludePaths: (Optional) Specify the exclude file and directory.
    Specifies a relative path from the "InputPath", with a comma separated list.
  • -createAssociation: (Optional) Create object associations from references of fields and properites.
  • -allInOne: (Optional) Only if -dir is set: copy the output of all diagrams to file include.puml (this allows a PlanUMLServer to render it).

examples

puml-gen C:\Source\App1\ClassA.cs -public
puml-gen C:\Source\App1 C:\PlantUml\App1 -dir -ignore Private,Protected -createAssociation -allInOne
puml-gen C:\Source\App1 C:\PlantUml\App1 -dir -excludePaths bin,obj,Properties

Specification for conversion to PlantUML

Type Declaration

Type Keywords

C# PlantUML
class class
struct <<struct>> class
interface interface
enum enum

Type Modifiers

C# PlantUML
abstract abstract
static <<static>>
partial <<partial>>
sealed <<sealed>>
  • C#
class ClassA {  
}
struct StructA {
}
interface InterfaceA {
}
abstract class AbstractClass {
}
static class StaticClass {
}
sealed partial class ClassB{
}
enum EnumType{
  Apple,
  Orange,
  Grape
}
  • PlantUML
@startuml
class ClassA {
}
class StructA <<struct>> {
}
interface InterfaceA {
}
abstract class AbstractClass {
}
class StaticClass <<static>> {
}
class ClassB <<sealed>> <<partial>> {
}
enum EnumType {
    Apple,
    Orange,
    Grape,
}
@enduml

TypeDeclaration.png

Generics Type

  • C#
class GenericsType<T1>{
}
class GenericsType<T1,T2>{
}
  • PlantUML
class "GenericsType`1"<T1>{
}
class "GenericsType`2"<T1,T2>{
}

GenericsTypeDeclaration.png

Member Declaration

Accessibility Modifiers

C# PlantUML
public +
internal <<internal>>
protected internal # <<internal>>
protected #
private -

Modifiers

C# PlantUML
abstract {abstract}
static {static}
virtual <<virtual>>
override <<override>>
new <<new>>
readonly <<readonly>>
event <<event>>

Property Accessors

C# PlantUML
int Prop {get; set;} Prop : int <<get>> <<set>>
int Prop {get;} Prop : int <get>
int Prop {get; private set } Prop : int <<get>><<private set>>
int Prop => 100; Prop : int <<get>>
  • C#
abstract class AbstractClass
{
    protected int _x;
    internal int _y;
    protected internal int _z;
    public abstract void AbstractMethod();
    protected virtual void VirtualMethod(string s){

    }
    public string BaseMethod(int n){
        return "";
    }
}
class ClassM : AbstractClass
{
    public static readonly double PI =3.141592;
    public int PropA { get; set; }
    public int PropB { get; protected set; }
    public event EventHandler SomeEvent;
    public override void AbstractMethod(){
        
    }
    protected override void VirtualMethod(string s)
    {

    }
    public override string ToString()
    {
        return "override";
    }
    public new string BaseMethod(int n){
        return "new";
    }
}
  • PlantUML
abstract class AbstractClass {
    # _x : int
    <<internal>> _y : int
    # <<internal>> _z : int
    + {abstract} AbstractMethod() : void
    # <<virtual>> VirtualMethod(s:string) : void
    + BaseMethod(n:int) : string
}
class ClassM {
    + {static} <<readonly>> PI : double = 3.141592
    + PropA : int <<get>> <<set>>
    + PropB : int <<get>> <<protected set>>
    +  <<event>> SomeEvent : EventHandler 
    + <<override>> AbstractMethod() : void
    # <<override>> VirtualMethod(s:string) : void
    + <<override>> ToString() : string
    + <<new>> BaseMethod(n:int) : string
}
AbstractClass <|-- ClassM

MemberDeclaration.png

Field and Property Initializers

Only literal initializers are output.

  • C#
class ClassC
{
    private int fieldA = 123;
    public double Pi {get;} = 3.14159;
    protected List<string> Items = new List<string>(); 
}
  • PlantUML
class ClassC {
  - fieldA : int = 123
  + Pi : double = 3.14159
  # Items : List<string>
}

Initializer.png

Nested Class Declaration

Nested classes are expanded and associated with "OuterClass + - InnerClass".

  • C#
class OuterClass 
{
  class InnerClass 
  {
    struct InnerStruct 
    {

    }
  }
}
  • PlantUML
class OuterClass{

}
class InnerClass{

}
<<struct>> class InnerStruct {

}
OuterClass +- InnerClass
InnerClass +- InnerStruct

NestedClass.png

Inheritance Relationsips

  • C#
abstract class BaseClass
{
    public abstract void AbstractMethod();
    protected virtual int VirtualMethod(string s) => 0;
}
class SubClass : BaseClass
{
    public override void AbstractMethod() { }
    protected override int VirtualMethod(string s) => 1;
}

interface IInterfaceA {}
interface IInterfaceA<T>:IInterfaceA
{
    T Value { get; }
}
class ImplementClass : IInterfaceA<int>
{
    public int Value { get; }
}
  • PlantUML
abstract class BaseClass {
    + {abstract} AbstractMethod() : void
    # <<virtual>> VirtualMethod(s:string) : int
}
class SubClass {
    + <<override>> AbstractMethod() : void
    # <<override>> VirtualMethod(s:string) : int
}
interface IInterfaceA {
}
interface "IInterfaceA`1"<T> {
    Value : T <<get>>
}
class ImplementClass {
    + Value : int <<get>>
}
BaseClass <|-- SubClass
IInterfaceA <|-- "IInterfaceA`1"
"IInterfaceA`1" "<int>" <|-- ImplementClass

InheritanceRelationsips.png

Associations (from references of fields and properties)

If you specify the "createAssociation" option, object associations is created from field and property references.

  • C#
class ClassA{
    public IList<string> Strings{get;} = new List<string>();
    public Type1 Prop1{get;set;}
    public Type2 field1;
}

class Type1 {
    public int value1{get;set;}
}

class Type2{
    public string string1{get;set;}
    public ExternalType Prop2 {get;set;}
}
  • PlantUML
@startuml
class ClassA {
}
class Type1 {
    + value1 : int <<get>> <<set>>
}
class Type2 {
    + string1 : string <<get>> <<set>>
}
class "IList`1"<T> {
}
ClassA o-> "Strings<string>" "IList`1"
ClassA --> "Prop1" Type1
ClassA --> "field1" Type2
Type2 --> "Prop2" ExternalType
@enduml

InheritanceRelationsips.png

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].