UML

Table of Contents

1 Plantuml

1.1 Installation

Set the path in org-plantuml-jar-path variable in emacs. C-c C-c to evaluate it, and C-c C-x C-v (org-toggle-inline-image) to show the image inline.

The block line:

#+BEGIN_SRC plantuml :file wikitmp_plantuml.png :exports results

1.2 Class Diagram

abstract class AbstractClass {
  field
  Method()
  .. Seperators ..
  #ProtectedField
  ==
  -PrivateMethod()
  __
  +PublicMethod()
  ~PackagePrivateField
  --
  {static} StaticField
  {abstract} AbstractMethod()
}
class Concrete
class Single << (S,#FF7700) Singleton >>

Single "A side note" <|-- "B side note" Concrete : extension
AbstractClass --* Concrete : Composition,\nmultiline
AbstractClass --o Single : Aggregation
AbstractClass -- Single : just a line
AbstractClass ..|> Single : dotted, with arrow >
note left of AbstractClass : note left of A, can be\n<b>top,bottom,left,right</b>


1.3 Sequence Diagram

Sequence Diagram is used to describe the communication of participants. The message can be sent to myself.

title: Some Title
'this is a comment
participant Alice
actor Bob
database DB

Alice -> Bob : label on arrow
Alice <-- Bob : dotted arrow
note right: a note

== seperator ==
Alice -[#red]> DB : red arrow
...5 minutes later...
Alice -[#0000ff]-> Cindy : the color #0000ff
...
Bob -> Cindy
Bob -> Bob : self-messaging

note left
        multiple
        line
        note
end note

note left of Alice #cyan
        multi-line
        note
        left of Alice,
        in background cyan
end note

note left of Bob: Bob is an "actor"
note left of DB: DB is a "database"
note left of Cindy: Cindy is anonymous

note over Alice: note over Alice