Git Product home page Git Product logo

umlclassdiagram's Introduction

umlclassdiagram example

UML Class Diagram for Scala

License: MIT release-badge maven-central-badge CI-CD BCH compliance Coverage Status

Inspired by xuwei-k/sbt-class-diagram

Table of Contents

Table of content generated by gh-md-toc

Setup

Requirements

You are required to install Graphviz to generate the SVG from the dot file.

If you do not need the generation of the SVG file, you can apply this setting:

classDiagramSettings := classDiagramSettings.value.copy(generateSvg = false)

in your build.sbt.

Enable plugin

First add

addSbtPlugin("com.leobenkel" % "umlclassdiagram" % "[VERSION]")

to project/plugin.sbt

Version: maven-central-badge

and then

enablePlugins(UmlClassDiagramPlugin)

to build.sbt

Which connections would you like to show?

To change which connection you would like to display, add this:

classDiagramSettings :=
  classDiagramSettings
    .value
    .copy(
      enabledConnectionTypes =
        Set(
          com.leobenkel.umlclassdiagram.internal.ConnectionType.Inherit,
          com.leobenkel.umlclassdiagram.internal.ConnectionType.Produce,
          com.leobenkel.umlclassdiagram.internal.ConnectionType.Consume,
          com.leobenkel.umlclassdiagram.internal.ConnectionType.Throw,
          com.leobenkel.umlclassdiagram.internal.ConnectionType.Enclosing,
        ),
    )

to your build.sbt.

The possibilities are:

  • Inherit
    • will connect the classes with their parent trait and classes
    • This is the default behavior.
  • Produce
    • Will connect the classes to the classes that can be returned
    • Will not find out about generic type like Seq[A] or Foo[A]
  • Consume
    • Will connect the classes to the classes that are used as arguments
  • Throw
    • Will connect the classes to the classes being thrown
  • Enclosing
    • Will connect the classes to the parent class where the class is defined is it exist.

Styling

You can read more about the key/values available for dot graph styling with this document: https://www.graphviz.org/pdf/dotguide.pdf .

Use

To analyze a specific class:

sbt classDiagram path.to.Class

To browse entire package:

sbt classDiagram path.to.package.*

And those can be combined:

sbt classDiagram path.to.Class path.to.package.* pack.to.other.Class

Settings

To open the folder with output files and/or the SVG image

classDiagramSettings := classDiagramSettings.value.copy(openFolder = true, openSvg = true)

in your build.sbt.

To change the name of the file

classDiagramSettings := classDiagramSettings.value.copy(name = "foo")

in your build.sbt.

Authors

Leo Benkel

  • leobenkel-github-badge
  • leobenkel-linkedin-badge
  • leobenkel-personal-badge
  • leobenkel-patreon-badge

umlclassdiagram's People

Contributors

leobenkel avatar scala-steward avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.